Friday, June 19, 2009

RECURSIVE

1. GCD
int gcd(int,int);
int main()
{
int x,y;
printf("\nENTER TWO NO.S");
scanf("%d %d ",&x,&y);

printf("THE GCD OF TWO NO.IS %d", gcd(x,y));
getch();
}
int gcd(intx,inty)
{
if(y==0)
return(x);
else
return gcd(y,x%y);
}

No comments:

Post a Comment