11 2021 档案

摘要:1.定义一个含有8个存储单位的实型数组,从键盘上接受数,然后逆序输出 #include<stdio.h> main(){ int a[8]; int i; for(i=0;i<=7;i++){ scanf("%d",&a[i]); } for(i=7;i>=0;i--){ printf("%d",a 阅读全文
posted @ 2021-11-18 21:52 苏本琪 阅读(24) 评论(0) 推荐(0)
摘要:1.猜数字,如果大了提示大了点,小了提示小了点 #include<stdio.h> #include <stdlib.h> #include <time.h> int main() { while(1){ int a=0,b; srand((unsigned)time(NULL)); a = ran 阅读全文
posted @ 2021-11-15 23:38 苏本琪 阅读(30) 评论(0) 推荐(0)
摘要:1.将输入的分数mark(0-100整数)转换为相应的等级(90-100为A,80-90为B,70-80为C,60-69为D,0-59为NO PASS!)。 #include<stdio.h> main(){ int mark; printf("请输入学生的分数(0-100):\n"); scanf 阅读全文
posted @ 2021-11-15 23:27 苏本琪 阅读(52) 评论(0) 推荐(0)
摘要:1.编写程序判断n为正数还是负数 #include<stdio.h> main(){ int n; printf("请输入数字"); scanf("%d",&n); if(n<0) printf("%d是负数",n); else if(n==0) printf("%d是非正非负数",n); else 阅读全文
posted @ 2021-11-15 23:06 苏本琪 阅读(46) 评论(0) 推荐(0)
摘要:1, 1.#include<stdio.h> main(){ int i,j; for(i=1;j<=5;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } } 2, 3.#include<stdio.h> main(){ int i,j, 阅读全文
posted @ 2021-11-09 10:35 苏本琪 阅读(54) 评论(0) 推荐(0)
摘要: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",sum); } 2.编写程序,使用while语句求和sum 阅读全文
posted @ 2021-11-02 21:08 苏本琪 阅读(34) 评论(0) 推荐(0)