摘要:
1. 编写程序,接收一名学生的数学、外语、计算机三科成绩,并输出总分sum和平均分average(精确到两位小数)。 #include<stdio.h> main() { int A,B,C,sum; float average; printf("请输入数学,英语,计算机成绩\n"); scanf( 阅读全文
摘要:
输入一个三位数,求个位,十位,百位 #include<stdio.h> main() { int a; printf("输入一个三位数"); scanf("%d",&a); printf("个位是:%d\n十位是:%d\n百位是%d\n",a/100,a%100/10,a%10); } 输入一个年份 阅读全文
摘要:
1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> #include<string.h> void mainMenu(); void login(); void returnTo 阅读全文
摘要:
1编写程序,统计字符串中大写字母的个数。 #include<stdio.h> main() { char str[20]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') { if(str[i]>='A'&&str[i]<='Z') cnt++; 阅读全文
摘要:
定义一个含有8个存储单元的实行数组,从键盘上接收数,然后逆序输出。 #include<stdio.h> main() { double m[8]; int i; for(i=0;i<=7;i++) scanf("%lf",&m[i]); for(i=7;i>=0;i--) printf("%f",m 阅读全文
摘要:
1.随机产生一个0-99的数,猜猜看,如果大了,就显示大了点;如果小了,就显示小了点,直到猜对为止。 #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int a,n; srand((unsigned)time(NU 阅读全文
摘要:
1. 输出以下图形 * ** *** **** ***** ******* ***** *** * #include<stdio.h> int main() { int i, j ; for (i = 1; i <= 5; i++) { for (j = 1; j <=i; j++) printf( 阅读全文
摘要:
1编写程序,使用while语句求和sum=1+3+5+…+21 #include<stdio.h> main() { int i=1,sum=0; while(i<=21) { sum+=i; i+=2; } printf("%d\n",sum); } 2.编写程序,使用while语句求和sum=1 阅读全文
摘要:
1. #include<stdio.h> main() { int mark; printf("输入学生的分数(0-100):\n"); scanf("%d”,&mark); switch(mark/10) { case 10: //与case9:共用一条语句 case 9:printf("A\n" 阅读全文