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-29 17:27 陈快乐; 阅读(12) 评论(0) 推荐(0)
摘要:1.分数转成等级。(用switch结构) #include<stdio.h>main(){ int mark; printf("输入分数:\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");break; c 阅读全文
posted @ 2021-10-26 12:14 陈快乐; 阅读(32) 评论(0) 推荐(0)
摘要:1.编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main(){ float n; scanf ("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数,也不是负数!\n"); else print 阅读全文
posted @ 2021-10-19 11:48 陈快乐; 阅读(30) 评论(0) 推荐(0)
摘要:1.编写程序,定义两个整型变量,赋值并输出。 #include<stdio.h>main(){ int a=2; int b=6; printf("%d%d\n",a,b);} 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。#include<stdio.h>main(){ float 阅读全文
posted @ 2021-10-12 11:47 陈快乐; 阅读(59) 评论(0) 推荐(0)
摘要:1.编写程序,输出“我爱学习C语言!”。 #include<stdio.h> main() { printf("我爱学习C语言!"); } 2.分行输出自己的专业和姓名。 #include<stdio.h> main() { printf("计算机科学与技术\n"); printf("陈美杰\n") 阅读全文
posted @ 2021-10-06 21:11 陈快乐; 阅读(11) 评论(0) 推荐(0)