10 2021 档案

摘要:1.编写程序判断n是正数还是负数 #include main(){ int n; printf("输入n的值\n"); scanf("%d",&n); if(n*-1<0) printf("n为正数"); else if(n*-1==0) printf("n为0"); else if(n*-1>0) 阅读全文
posted @ 2021-10-30 22:24 张云月 阅读(49) 评论(0) 推荐(0)
摘要:编写程序,判断学生的成绩是什么等级 #include<stdio.h> main(){ int score; printf("输入学生的分数\n"); scanf("%d",&score); switch(score/10) { case 10:printf("A\n");break; case 9 阅读全文
posted @ 2021-10-27 21:53 张云月 阅读(41) 评论(0) 推荐(0)
摘要:编写程序,判断一个数是正数还是负数 #include<stdio.h> main() { float m; scanf("%f",&m); if(m>0) printf("m为正数\n"); else if(m==0) printf("m既不是正数也不是负数\n"); else if(m<0) pr 阅读全文
posted @ 2021-10-19 21:40 张云月 阅读(35) 评论(0) 推荐(0)
摘要:编写程序,使用scanf()函数接受整型,实型,字符型的变量,并分行依次输出。 #include<stdio.h> main(){ int a; float b; char c; scanf("%d %f %c",&a,&b,&c); printf("%d\n%f\n%c\n",a,b,c); } 阅读全文
posted @ 2021-10-16 21:18 张云月 阅读(36) 评论(0) 推荐(0)
摘要:编写程序,定义两个整形变量,赋值并输出 #include<stdio.h> main() { int a=1; int b=2; printf("%d\nW%d\n",a,b); } 编写程序,定义一个单精度和一个双精度的变量,赋值并输出 #include<stdio.h> main() { dou 阅读全文
posted @ 2021-10-12 21:26 张云月 阅读(32) 评论(0) 推荐(0)