- 博客(2)
- 收藏
- 关注
原创 C语言:n位数比大小
#include <stdio.h> main() { int str[1000],i=0,han; char ch; do { scanf("%d",&str[i++]); }while((ch=getchar())!='\n'); int len=i; for(int k=len-2;k>=0;k--) { for(int j=0;j<=len-2;j++) { if(str[j]>str[j+1]) { han=str[j]; str[j
2021-01-24 20:05:35
781
原创 C语言:1~n之间需要几个符号2
C语言:1~n之间需要几个符号2 有一次,偶然间看到一个题目大概是这样的有2千多户人家,现在需要为每户人家制作相应的门牌号,问需要多少个‘2’这种门牌号。 然后就想出了这样一个代码 #include <stdio.h> int sglen(int j) { int l,chang=0; for(;;) { chang++; j/=10; if(j==0) { break; } } return chang; } int sg(int i) { int y
2021-01-24 13:55:53
262
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人