Last active
June 10, 2017 17:35
-
-
Save harlos0517/6716376d2aa7b03c488e7ea3f6121f58 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* Problem 1 */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(){ | |
// while 內的程式碼請再原大括號裏面排序喔! | |
/*請排序*/ if(a < b){ | |
c = a; | |
a = b; | |
b = c; | |
} | |
/*請排序*/ int a, b, c; | |
/*請排序*/ while( b!=0 ){ | |
/*請排序*/ a = c; | |
/*請排序*/ b = a%b; | |
/*請排序*/ c = b; | |
} | |
/*請排序*/ printf("%d", a); | |
/*請排序*/ scanf("%d %d", &a, &b); | |
system("pause"); | |
return 0; | |
} | |
// TITLE : 求兩數之最大公因數 | |
// INPUT : 兩數 (a,b) = (9867, 10143) | |
// OUTPUT: a,b的最大公因數 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment