10 2021 档案

摘要:1.编码程序判断一个数是正数还是负数. #include<stdio.h> main() { int a; printf("请输入一个数"); scanf("%d",&a); if(a>0) printf("%d是正数",a); else printf("%d是负数",a); } 2.使用条件运算符 阅读全文
posted @ 2021-10-30 20:16 李治浩 阅读(49) 评论(0) 推荐(0)
摘要:1.使用switch语句实现分数分级判断 #include<stdio.h> main() { int mark; printf("请输入分数"); scanf("%d",&mark); switch(mark/10) { case 10: case 9: printf("A\n"); break; 阅读全文
posted @ 2021-10-28 23:11 李治浩 阅读(60) 评论(0) 推荐(0)
摘要:输入单价,数量,计算总金额,打八折,计算折后价.输入付款金额,计算找零 #include<stdio.h> main(){double price,sum,pay,zhaoling;int num,moling;printf("请输入商品单价\n");scanf("%lf",&price);prin 阅读全文
posted @ 2021-10-16 12:05 李治浩 阅读(43) 评论(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%c\n",a,b,c); 阅读全文
posted @ 2021-10-15 18:18 李治浩 阅读(34) 评论(0) 推荐(0)
摘要:编写程序,定义两个整形变量你,赋值并输出 #include<stdio.h> main() { int a=2; int b=6; printf("%d %d\n",a,b); } 2.编写程序,定义一个单精度和双精度的变量,赋值并输出 #include<stdio.h> main() { floa 阅读全文
posted @ 2021-10-13 21:58 李治浩 阅读(35) 评论(0) 推荐(0)
摘要:#include<stdio.h> main() { printf("我爱学习C语言"); } #include<stdio.h> main() { printf("计算机科学与技术\n"); printf("李治浩\n"); } 4.编写程序,定义两个整型变量,赋值并输出 #include<std 阅读全文
posted @ 2021-10-07 23:02 李治浩 阅读(18) 评论(0) 推荐(0)