Skip to content

Instantly share code, notes, and snippets.

@jatinsharrma
Created March 27, 2019 12:45
Show Gist options
  • Save jatinsharrma/9701241070a1ddcf4d7257826d457508 to your computer and use it in GitHub Desktop.
Save jatinsharrma/9701241070a1ddcf4d7257826d457508 to your computer and use it in GitHub Desktop.
to find GCD of two numbers
#include <stdio.h>
int gcd(int a, int b){
int ans = -1;
while(ans != 0){
ans = a%b;
a = b;
b = ans;
}
return(a);
}
void main() {
int a;
a = gcd(96,28);
printf("%d",a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment