umm, i need help with this, i have no idea how to make it return the greatest common divisor, this code works without returning anything, but i need to make the code to RETURN it......i gotten everything down, just donno how to return the answer....
Code:
#include <stdio.h>
#include <stdlib.h>
int GCD( int a,int b, int r);
int main()
{
int r,a,b;
printf("Please enter two integers separated by a space: ");
scanf("%d %d",&a,&b);
printf("\nYou entered: %d %d ",a,b);
if(a+b>0)
{
while (b)
{
r = a % b;
a = b;
b = r;
}
r=GCD(a,b,r);
printf("\n\n\nGCD: %d\n\n",r);
}
else
{
return 0;
}
system("PAUSE");
return 0;
}
int GCD(int a,int b, int r)
{
return ;
}