C Program to find GCD (Greatest Common Divisor) of two numbers

Monday, 9 September 2013

#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,x,y;
clrscr();
printf("Enter the two number");
scanf("%d%d",&x,&y);
if(x>y)
m=y;
else
m=x;
for(i=m;i>=1;i--)
{
if(x%i==0&&y%i==0)
{
printf("\n HCF is %d",i);
break;
}
}
getch();
}


OUTPUT-

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
Related Posts Plugin for WordPress, Blogger...
 

Most Reading

Labels