#include<stdio.h>
int main()
{
int n,m,i;
int gcd=0;
printf("Please Enter 1st Number: ");
scanf("%d",&n);
printf("Please Enter 2nd Number: ");
scanf("%d",&m);
///Finding the GCD
for(i=1;i<=n && i<=m;i++)
{
if(n%i==0 && m%i==0)
{
gcd=i;
}
}
printf("
The GCD of %d and %d is: %d
",n,m,gcd);
return 0;
}
Output
Please Enter 1st Number:10
Please Enter 2nd Number:15
The GCD of 10 and 15 is: 5
Add your comment