摘要:
猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include<stdio.h> main() { int num=36; int guess; do{ printf("输入要猜的数,1-100\n"); scanf("%d",&guess 阅读全文
摘要:
1. * ** *** **** ***** #include<stdio.h> main() { int i,j; for(i=1;i<=5;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } ******* ***** *** * #i 阅读全文
摘要:
1编写程序,使用while语句求和sum=1+3+5+...+1。 #include<stdio.h> main() int i=1; int sum=0; while(i<=21) { sum+=i; i+=2; } printf("sum=%d\n",sum); } 2编写程序,使用while语 阅读全文
摘要:
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既不是正数,也 阅读全文
摘要:
#include<stdio.h> main() { int mark; printf("请输入学生的分数(0-100):\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");break; case 8:pr 阅读全文