You are on page 1of 1

#include <stdio.

h> int main() { int a,b; int gcd(int, int); printf("Enter values for a and b"); scanf("%d%d",&a,&b); printf("\nGCD of %d and %d is %d",a,b,gcd(a,b)); return(0); } int gcd(int a, int b) { int r; while(b!=0) { r=a%b; a=b; b=r; } return(a); }

You might also like