10 2021 档案

摘要:1.编写程序判断n是正数还是负数。 #include<stdio.h> main() { int n; printf("请输入一个整数:\n"); scanf("%d",&n); if(n>0) printf("%d是正数!\n",n); else if(n==0) printf("%d既不是正数, 阅读全文
posted @ 2021-10-31 09:40 慢慢的乌龟 阅读(33) 评论(0) 推荐(0)
摘要:#include<stdio.h> main() { int mark; printf("请输入学生的分数(0-100):\n"); scanf("%d",&mark); switch(mark/10) { case 10: //与case9:共用一条语句 case 9:printf("A\n"); 阅读全文
posted @ 2021-10-26 12:30 慢慢的乌龟 阅读(31) 评论(0) 推荐(0)
摘要:编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数,也不是负数!\n"); else printf( 阅读全文
posted @ 2021-10-19 17:05 慢慢的乌龟 阅读(29) 评论(0) 推荐(0)
摘要:1.编写程序,使用scanf()函数接收整型、实型、字符型的变量,并分行依次输出。 #include<stdio.h> main() { int a; float b; char c; scanf("%d %f %c",&a,&b,&c); printf("%d\n%f\n%d\n",a,b,c); 阅读全文
posted @ 2021-10-16 09:38 慢慢的乌龟 阅读(35) 评论(0) 推荐(0)
摘要:三,编写程序. 1.编写程序,定义两个整形变量,赋值并输出. #include<stdio.h> main() { int a=2; int b=6; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> m 阅读全文
posted @ 2021-10-12 11:19 慢慢的乌龟 阅读(158) 评论(0) 推荐(0)