After successfully completing the challenge I decided to take it another step. I attempted to add recursion so the program would start squaring at 0 and continually increase by 1 and compute. After a few minutes of tinkering I finally got a successful compile. The computations are correct from 0 until it reaches 46341. Suddenly the computations turn negative and begin to increase. Eventually it seems I get an error at 262022 squared. I have tried changing some of the variable types and that makes all the computations incorrect. Any advise to what it is causing these errors to occur. I am very new to coding and would appreciate any guidance or adviseā¦Thanks!
[code]#include <stdio.h>
#include <unistd.h>
void squared (int squarer)
{
int solution = squarer*squarer;
printf("\"%d\" squared is \"%d\".\n", squarer, solution);
int plusOne = squarer +1;
squared (plusOne);
}
int main(int argc, const char * argv[])
{
squared(0);
return 0;
}[/code]