#include<stdio.h>
#include<conio.h>
int Gcd(int a, int b)
{
int c;
while(a%b!=0)
{
c=a%b;
a=b;
b=c;
}
return b;
}
void main()
{
int a,b;
clrscr();
printf("Enter a= ");
scanf("%d",&a);
printf("Enter b= ");
scanf("%d",&b);
printf("GCD= %d",Gcd(a,b));
getch();
}
From: Book by ashraf
No comments:
Post a Comment
Comment of this content!