随笔分类 -  c语言入门

摘要:#include<stdio.h> main() { int n,t; int sum;; sum=0; scanf("%d",&n); for(t=1;t<=n;t+=2) { sum=sum+t; } printf("%d",sum); } 阅读全文

posted @ 2022-10-12 21:32 lachesism 阅读(292) 评论(0) 推荐(0) 编辑

摘要:#include<stdio.h> main() { int n,a; a=1; scanf("%d",&n); while(n>10) { n=n/10; a++; } printf("%d",a); } 阅读全文

posted @ 2022-10-12 19:50 lachesism 阅读(113) 评论(0) 推荐(0) 编辑

摘要:#include<stdio.h> main() { int n; scanf("%d",&n); while(n>10) { n=n/10; } printf("%d",n); } 阅读全文

posted @ 2022-10-12 19:48 lachesism 阅读(128) 评论(0) 推荐(0) 编辑

摘要:#include<stdio.h> main() { int n,a; scanf("%d",&n); a=0; while(n>10) { a=n%10; n=n/10; if(a==0) { continue; } else printf("%d",a); } printf("%d",n); } 阅读全文

posted @ 2022-10-12 19:46 lachesism 阅读(217) 评论(0) 推荐(0) 编辑

摘要:#include<stdio.h> main() { int a,b,suma,sumb; scanf("%d %d",&a,&b); suma=0; sumb=0; while(a!=0||b!=0) { if(a==1) { suma=suma+b; } else if(a==2) { sumb 阅读全文

posted @ 2022-09-26 23:11 lachesism 阅读(394) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int n,m,sum=0; scanf("%d",&n); m=n%10; sum=sum+m; printf("%d",m); n=n/10; while(n!=0) { m=n%10; sum=sum+m; printf("+%d",m) 阅读全文

posted @ 2022-09-26 23:10 lachesism 阅读(271) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int x,t,m; scanf("%d",&x); t=0; m=x; while(x!=0) { x=x/10; t++; } x=m; t=t-1; while(t!=0) { x=x/10; t--; } printf("%d",x); 阅读全文

posted @ 2022-09-26 23:09 lachesism 阅读(188) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int t,x; float sum; t=0; sum=0; scanf("%d",&x); if(x 1) { printf("无数据"); } else{ while (x!=-1) { sum+=x; t++; scanf("%d",& 阅读全文

posted @ 2022-09-26 23:08 lachesism 阅读(370) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int t,x; t=0; scanf("%d",&x); while (x!=0) { x=x/10; t++; } printf("%d", t); } 阅读全文

posted @ 2022-09-26 23:08 lachesism 阅读(214) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int t,x; scanf("%d",&x); t=-1; while (x!=-1) { if(x>t) { t=x; } scanf("%d",&x); } printf("%d", t); } 阅读全文

posted @ 2022-09-26 23:07 lachesism 阅读(215) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int m, n, j=0, k=0; scanf("%d %d",&m,&n); j = m; while (j % n != 0) { j = j + m; k = (m * n) / j; } printf("最小公倍数是%d\n最大公约 阅读全文

posted @ 2022-09-26 23:06 lachesism 阅读(21) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> int main() { int year, month, day; int sum = 0, flag = 0; scanf("%d %d %d", &year, &month, &day); switch(month) { case 1: sum = 0; 阅读全文

posted @ 2022-09-26 23:04 lachesism 阅读(117) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main() { int year, month; scanf("%d %d", &year, &month); switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: 阅读全文

posted @ 2022-09-26 23:02 lachesism 阅读(119) 评论(0) 推荐(0) 编辑

摘要:#include<stdio.h> int main() { int x,y,z,t; scanf("%d %d %d",&x,&y,&z); if(x<y) { t=x;x=y;y=t; } if(x<z) { t=x;x=z;z=t; } if(y<z) { t=y;y=z;z=t; } pri 阅读全文

posted @ 2022-09-26 22:48 lachesism 阅读(655) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> int main() { int x,y; scanf("%d %d",&x,&y); if(x<y) { printf("%d %d",x,y); } else { printf("%d %d",y,x); } } 阅读全文

posted @ 2022-09-26 22:46 lachesism 阅读(253) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> int main() { char a; scanf("%c",&a); if(a >= 65 && a<= 90) { printf("upper"); } else if(a >= 97 && a <= 122) { printf("lower"); } e 阅读全文

posted @ 2022-09-26 22:45 lachesism 阅读(742) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> int main() { char x; scanf("%c", &x); if (x >= 'a' && x <= 'z') printf("%c", x - 32); else if (x >= 'A' && x <= 'Z') printf("%c", x 阅读全文

posted @ 2022-09-26 22:44 lachesism 阅读(270) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main( ) { int a,b,c; int flag=1; scanf("%d %d %d",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) { if(a==b&&b==c) { printf("dengbian\n"); flag= 阅读全文

posted @ 2022-09-19 20:59 lachesism 阅读(902) 评论(0) 推荐(0) 编辑

摘要:#include <stdio.h> main( ) { int a,d=0; scanf("%d",&a); while(a>86399) { a=a-86400; d++; if(a<86399) { break; } } if(a<43199&&d!=0) { int h; h=a/3600; 阅读全文

posted @ 2022-09-19 20:25 lachesism 阅读(350) 评论(0) 推荐(0) 编辑

摘要:#include<stdio.h> #include<stdlib.h> int main(){ int n = 0; scanf("%d", &n); int result = 0; if(n < 0){ n = -n; printf("-"); } while(1) { result = n % 阅读全文

posted @ 2022-09-19 20:09 lachesism 阅读(192) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示