Program to find square() function and use it to print the squares of the numbers 1-10.

int square(int x)
{
return x * x;
}

Here is a loop and main program to call it:



int square(int);

int main()
{
int i;

for(i = 1; i <= 10; i = i + 1) printf("%d %d\n", i, square(i)); return 0; }

No comments:

Post a Comment