C programming
Tuesday, 4 October 2011
Program to print GCD of two nos.
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y, i,m ;
clrscr();
printf("enter two nos.: \n");
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 GCD is :%d ",i);
break;
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment