摘要: #include<stdio.h> main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } } #include<stdio.h> main(){ int i,j,k; for( 阅读全文
posted @ 2021-11-25 20:38 张瑶~ 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用while语句求和sum=1+3+5+7+…+21。 #include <stdio.h> main() { int a=1,sum=0; while(a<=21) { if(a%2==1) { sum+=a; } a++; } printf("%d",sum); } 2.编写程序 阅读全文
posted @ 2021-11-25 20:35 张瑶~ 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断n是正数还是负数。 #include <stdio.h> main() { float n; printf("输入一个数:\n"); scanf("%f",&n); if(n>0) printf("正数\n"); else if(n==0) printf("既不是正数也不是负数\n" 阅读全文
posted @ 2021-11-25 20:22 张瑶~ 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 恢复内容开始 #include<stdio.h> main() { int mark; printf("输入学生的分数(0-100):"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n"); break; case 阅读全文
posted @ 2021-11-25 20:14 张瑶~ 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1 编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数也不是负数"); else printf("负 阅读全文
posted @ 2021-11-25 20:06 张瑶~ 阅读(6) 评论(0) 推荐(0) 编辑