![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
练习题
稚淮粥
最难不过最难
展开
-
辗转相除法求最大公约数
辗转相除法求最大公约数 #include <stdio.h> int main() { int a,b; int t; scanf("%d %d",&a,&b); while(b!=0){ t=a%b; a=b; b=t; } printf("%d",a); return 0; }原创 2021-01-20 20:20:55 · 95 阅读 · 0 评论 -
正序输出各个位数
正序输出各个位数 #include <stdio.h> int main() { int n,t,k; int count=1; scanf("%d",&n); t=n; //算出最大除数 while(t>9){ t/=10; count*=10; } //依次输出各个位数 while(count){ k=n/count; printf("%d\n",k); n%=count; count/=10; } return 0; }原创 2021-01-20 20:05:10 · 151 阅读 · 0 评论