Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created December 11, 2014 02:51
Show Gist options
  • Save shohan4556/546f5f2da0f5733c0b9e to your computer and use it in GitHub Desktop.
Save shohan4556/546f5f2da0f5733c0b9e to your computer and use it in GitHub Desktop.
GCD euclid
#include<stdio.h>
int main()
{
int a,b,c,i,j,temp,temp1;
while(scanf("%d %d",&a,&b)==2){
if(a<b){
temp1=a;
a=b;
b=temp1; // b get the value of a just swapped
}
while(a%b!=0){
temp=a;
a=b;
b=temp%b;
}
printf("%d\n",b);
temp=0;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment