Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
280 B
1
Indexable
#include<stdio.h>int gcd(int m, int n){if(n==0) // base casereturn m;if(m<n)return gcd(n,m); // general casereturn gcd(n, m%n);}int main(){int m, n, result;printf("Enter two numbers:\n ");scanf("%d %d",&m,&n);result = gcd(m,n);printf("GCD of %d and %d = %d",m,n,result);return 0;}