Alright Question to is as follows.

"Write a function sumsqr that consumes a non-negative integer n and prints all pairs (x, y)

such that x and y are nonnegative integers, x >= y, and x^2 + y^2 = n. Each pair is printed

on a separate line without the parentheses or comma. You may either print them in order of

increasing x or decreasing x. For example, the call sumsqr(50) would print either:

5 5

7 1

or

7 1

5 5

Your program should be able to list all 18 ways to write 446265625 as the sum of two

squares.

To submit: sumsqr.c, sumsqr-driver.c."

Now after looking at the question I realized that the highest possible number will be the square root of the number. So we're going to be implementing question #1.

(Question one was to make a function that found the highest integer for the squareroot of a number eg. isqrt(5) = 2, isqrt(10) = 3)

sumsqr-driver.c looks like

Code:

#include <stdio.h>
#include "sumsqr.h"
int main() {
printf("%d", sumsqr(50));
return 0;
}

sumsqr.c is

Code:

#include <math.h>
#include <stdio.h>
#include "isqrt.h"
int sumsqr(int n) {
int a = 0;
int b = 0;
int max = isqrt(n);
if (a == max) {
a = 0;
b = b+1;
return sumsqr(int n);
} else {
for (int i=1; i <= max; i=i+1) {
if (a*a + b*b == n) {
printf("%d %d", a, b);
a = a+1;
return sumsqr(int n);
} else {
a = a+1;
return sumsqr(int n);
}
}
}

and sumsqr.h contains which was given to us in a different part of the question

Code:

void sumsqr(int n);

And I'm kind of new to the whole prototype thing. But correct me if I'm wrong.

It is saying. It consumes a number and produces a void and in this case void is a set of printfs.

when i try to compile it using the line

Code:

gcc -std=c99 -O -o sumsqr sumsqr-driver.c sumsqr.c -lm

I get the errors

sumsqr-driver.c: In function 'main':

sumsqr-driver.c:6: error: invalid use of void expression

sumsqr.c: In function 'sumsqr':

sumsqr.c:13: error: parse error before "int"

sumsqr.c:19: error: parse error before "int"

sumsqr.c:22: error: parse error before "int"

sumsqr.c:25: error: pares error at end of input

~Stormweaver1~