Created
December 11, 2014 02:51
-
-
Save shohan4556/546f5f2da0f5733c0b9e to your computer and use it in GitHub Desktop.
GCD euclid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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