标签:c
//输入两个数 求最大公约数 #include <stdio.h> int main(int argc, const char * argv[]) { int a,b,tmp,c,d,y=1; printf("请输入两个数字:\n"); scanf("%d %d",&a,&b); if(b>a){ tmp = b; b = a; a = tmp; } c = a;d = b; while (y!=0) { y = c%d; c = d; d = y; } printf("最大公约数是:%d\n", c); return 0; }
标签:c
原文地址:http://13413367.blog.51cto.com/13403367/1973888