随笔分类 - C语言填空
摘要:#include <stdio.h> //输入10个学生成绩,统计高于平均分的人数 main() { 【1】 a[10],sum=【2】,pjz; 【3】 b; for(b=0;b<10;b++) { scanf("%f",【4】); sum=【5】; } pjz=【6】; 【7】; for(b=0
阅读全文
摘要:【1】 <stdio.h> //程序输出结果:3,2,2,3 【2】 fun(【3】 x,int y) { x=【4】; y=x-y; x=x-y; printf("【5】",x,y); } main() { int x=2,y=3; fun(x,y); printf("【6】",x,y); get
阅读全文
摘要:#include <stdio.h> //输出100-200间所有的素数,且一行只打印7个数 main() { int num,i,t,count; 【1】; for(num=100;num<=200;num++) { 【1】; for(i=2;i<=num-1;i++) if(【1】) { t=0
阅读全文
摘要:#include <stdio.h> //补充程序使输出结果是1,2,6,24,120 【1】 ff(int n) { 【2】 int f=1; f=【3】; return f; } main() { int i; for(i=1;【4】;i++) printf("%d,",【5】); printf
阅读全文
摘要:【1】 //全局变量与局部变量的使用 【2】d=1; 【3】 fun(int 【4】) { int d=5; d+=p++; printf("%d ",d); } main() { int a=3; 【5】;//以a为参数调用fun函数 d+=a++; printf("%d ",d); getcha
阅读全文
摘要:#include <stdio.h> //根据学生成绩输出评定等级。成绩为90-100分输出“A",成绩为80-89分输出"B" // 成绩为70-79分输出"C",成绩为60-69分输出"D",否则输出”E" main() { int cj;【1】; printf("please input st
阅读全文
摘要:#include <stdio.h> //任意输入两个整数,输出这两个数的最大公约数和最小公倍数 main() { int a,b,c,gys,gbs; scanf("%d%d",&a,&b) ; for(c=a;【1】;c--) { if(【2】) { gys=【3】; 【4】; } } gbs=
阅读全文
摘要:#include <stdio.h> //输出1980-2020年之间所有的闰年,每行三个 main() { int year,【1】,b; for(year=1980;year<=2020;year++) { 【2】; if(【3】) { printf("%5d",year); count++;
阅读全文
摘要:#include <stdio.h> //用来统计输入的字符中所有大写字母的个数,用#结束输入 main() { int a[26],i; char ch; for(i=0;i<26;i++) a[i]=【1】; ch=getchar(); while(【2】) { if(ch>=65&&ch<=9
阅读全文
摘要:#include <stdio.h> //功能:从键盘输入一个整数,如果不高于9999则逆序输出,否则打印“输入范围错误" main() { 【1】; 【2】; if(x<=9999) do{ printf("%d",【3】); 【4】; }【5】 else printf("输入范围错误"); ge
阅读全文
摘要:#include <stdio.h> //功能:从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩 //当输入负数时结束输入,请将程序补充完整 main() { float x,amax,amin; scanf("%f",【1】) ; amax=x; amin=x; while(【2】) {
阅读全文
摘要:#include <stdio.h> //求s=1-3+5-7+...-99+101并输出 main() { int i,t=1,【1】; for(i=1;【2】;【3】) { s=【4】; t=【5】; } printf("s=%d\n",s); getchar(); } 求s=1-3+5-7+.
阅读全文
摘要:#include <stdio.h> //求s=3+13+23+...+103 main() { int 【1】; for(i=0;【2】;i++) s=【2】; printf("s=【4】\n",s); getchar(); } #include <stdio.h> //求s=3+13+23+..
阅读全文
摘要:#include <stdio.h> //找出二维数组中的最大值,并输出所有最大值对应的行与列 main() { int a[5][5]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,24,24,15,16,21,17,18,19,24,22,23} ,max,hang,lie,
阅读全文
摘要:#include <stdio.h> //数组a中有8个不相等的元素,b中有5个不相等的元素,数组c中包含那些a中但不在b中的元素,并输出数组c各元素的值 main() { int a[8],b[5],i,j,count; 【1】 for(i=0;i<8;i++) 【2】 for(i=0;i<5;i
阅读全文
摘要:#include <stdio.h> //两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。 //已抽签决定比赛名单,有人向队员打听比赛的名单。a说他不和x比, //c说他不和x、z比,请完成程序填空,实现找出三队赛手的名单。 main() { char i,j,k;//i
阅读全文
摘要:#include <stdio.h> //求s=1+1/3+1/5+....之和,直到某一项的值小于10的-6次方时停止累加 main() { float a=1,【1】,b,c; while(【2】) { s=s+【3】; a=【4】; } printf("%f\n",s); getchar();
阅读全文
摘要:#include <stdio.h> // 一个小球从100米高度自由下落,每次落地后反跳回原来高度的一半,再下落, //求它在第十次下落地时,共经过多少米,第十次反弹多高? main() { float 【1】,sum,i=1; sum=【2】; while(i<=10) { height=hei
阅读全文
摘要:#include <stdio.h> //将字符数组a的全部字符复制到字符数组b中(要求不用strcpy函数) //并输出新字符串 【1】 main() { char a[100],b[100]; int c,d,f; 【2】; c=【3】; for(d=0;【4】;d++) b[d]=【5】; b
阅读全文
摘要:#include <stdio.h> //输入一个字符串(20个字符以内),判断其是否是回文字符串(回文字符串是指正反一样的字符串)。 【1】 main() { char a[21]; int b,【2】,len; 【3】; len=【4】; for(b=0;b<(len-1)/2;b++) if(
阅读全文