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-

1 comment

  1. If you are being attentive to learn several strategies then you ought to browse this article, I am certain you'll get much additional from this article.
    tutorial for c++

    ReplyDelete

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

Most Reading

Labels