All I want to do is divide the smaller number into the larger one. I has no issues test and getting the right answer. Now I wanted to pass the remainder and this is where the issues came.

After I can effectively get the remainder passed to (int sum2) I want to divide the smaller remainder into the larger one until the remainder is 0. I'll use a "while" statement for this.

Right now if I divide 9 / 3 = 0 r 3

3 / 9 = 0 r 3

5 / 5 =32767 R 1606416048

This is a very simple program and I going in circles here. Can anyone help.

Code:int remainder (int, int); // function protoype // #include <stdio.h> int remainder(int x, int y) // function header // { int sum1, sum2; if (x > y) { // the lesser divided into the highier // sum1 = y / x; sum2 = y%x; // the remainder is passed to sum2 // } if (y > x) { sum1 = x / y; sum2 = x%y; } return printf("The answer is %d and the remainder is %d", sum1, sum2); } int main(int argc, const char * argv[]) { int x,y; printf("Enter two numbers\n"); scanf("%d%d",&x, &y); remainder(x, y); // function called // return 0; }