Saturday 7 September 2013

finding GCD of two given numbers

#include<stdio.h>
#include<conio.h>
void main()
{
int u,v,t;
printf("enter two integers..");
scanf("%d%d",&u,&v);
while(v!=0)
{
t=u%v;
u=v;
v=t;
}
printf("gcd of two given numbers is..%d",u);
getch();
}


sample input and output:enter two integers:2,10
gcd of two given numbers is..2

No comments:

Post a Comment