#include<stdio.h>
#include<conio.h>
int gcd(int,int);
int main()
{
int a,b,result;
printf("Enter value 1: ");
scanf("%d",&a);
printf("Enter value 2: ");
scanf("%d",&b);
result=gcd(a,b);
printf("GCD of %d and %d is %d",a,b,result);
getch();
return 0;
}
int gcd(int m,int n)
{
if(m%n==0)
return n;
else
return (gcd(n,m%n));
}
#include<conio.h>
int gcd(int,int);
int main()
{
int a,b,result;
printf("Enter value 1: ");
scanf("%d",&a);
printf("Enter value 2: ");
scanf("%d",&b);
result=gcd(a,b);
printf("GCD of %d and %d is %d",a,b,result);
getch();
return 0;
}
int gcd(int m,int n)
{
if(m%n==0)
return n;
else
return (gcd(n,m%n));
}
No comments:
Post a Comment
Convey your thoughts to authors.