1、【程序填空】功能:求出二维数组中的最小元素值。#include /*FILL*/min_value(int m,int n,_) int i,j,min; min=array00; for(i=0;im;i+) for(j=0;j=【参考答案】min【参考答案】min_value(3,4,a)【程序填空】功能:输入两个整数x,y,求他们的阶乘和x!+y!。#include int fun (int ss) int i,n=1;/*FILL*/for(_;i=ss;i+)n=n*i;/*FILL*/_ n;main()int x,y; scanf(%d,%d,&x,&y);/*FILL*/ printf(x!+y!=%d,_); 【参考答案】i=1【参考答案】return【参考答案】fun(x)+fun(y)fun(y)+fun(x)【程序填空】功能:产生并输出如下形式的方阵。1 2 2 2 2 2 13 1 2 2 2 1 43 3 1 2 1 4 43 3 3 1 4 4 43 3 1 5 1 4 43 1 5 5 5 1 41 5 5 5 5 5 1#include main()
2、int a77; int i,j; for (i=0;i7;i+) for (j=0;j7;j+) /*FILL*/ if (_) aij=1; /*FILL*/ else if (ij&i+jj&i+j6) aij=3; /*FILL*/ else if (_) aij=4; else aij=5; for (i=0;i7;i+) for (j=0;j7;j+) printf(%4d,aij); /*FILL*/ _ 【参考答案】i=j|i+j=6【参考答案】aij=2【参考答案】i6【参考答案】printf(n)【程序填空】功能:建立一个元素值全为0的二维数组0 0 0 0 00 0 0 0 00 0 0 0 00 0 0 0 00 0 0 0 0并按以下格式输出。6 0 0 0 60 6 0 6 00 0 6 0 00 6 0 6 06 0 0 0 6#include void main() /*FILL*/ int a55=_,i,j; for(i=0;i5;i+) /*FILL*/ aii=_; /*FILL*/ ai_=6; for(i=0;i5;i+) /*FILL*/
3、for(j=0;j5;j+)printf(%2d,_); printf(n); 【空1参考答案】00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0【空2参考答案】6【空3参考答案】4-i【空4参考答案】aij【程序填空】写一个函数,求一个字符串的长度,在main函数中输入字 符串,并输出其长度。#include main() int length(char p); int len; char str20; printf(please input a string:n); scanf(%s,str); /*FILL*/ len=length(_); printf(the string has %d characters.,len);/*FILL*/_(char p) int n; n=0; while(pn!=0) /*FILL*/ _; return n;【空1参考答案】str【空2参考答案】int lengthlength【空3参考答案】n+nn=n+1n+=1n=1+n【程序填空】从低位开始取出长整型变量s中奇数位上的数,依次构成一
4、 个新数放在t中。#include stdio.h void fun (long s, long *t) long sl=10; s /= 10; /*FILL*/ *t = s _ 10; while(s0) /*FILL*/ s = _; /*FILL*/ *t = s%10*sl_; /*FILL*/ sl = sl _10; main() long s, t;printf(nPlease enter s:); scanf(%ld, &s);fun(s, &t);printf(The result is: %ldn, t);【空1参考答案】%【空2参考答案】s/100【空3参考答案】+ *t【空4参考答案】*【程序填空】功能:请编写函数fun,它的功能是:求出1到100之间能被7或11整除,但不能同时被7和11整除的所有整数并将它们放在a所指的数组中,通过n返回这些数的个数。#include int fun (int a) int i,n;/*FILL*/_;for(i=7;i100;i+)/*FILL*/if(i%7)=0|(i%11)=0)_(i%77)!=0) an+=i;
5、return n;main()int x1000,m,i;m=fun(x);/*FILL*/printf(n%dn, _);for(i=0;i=a&ch=z【程序填空】功能:将s所指字符串的正序和反序进行连接,形成一个新串放在t 所指的数组中。例如:当s串为ABCD时,则t串的内容应为ABCDDCBA。 #include #include #include void fun (char s, char t) int i, d; /*FILL*/ d = _; /*FILL*/ for (i = 0; id; _) ti = si; for (i = 0; id; i+) /*FILL*/ t_ = sd-1-i; /*FILL*/ t_ =0;main() char s100, t100; printf(nPlease enter string S:); scanf(%s, s); fun(s, t); printf(nThe result is: %sn, t);【参考答案】strlen(s)【参考答案】i+ii=i+1i+=1【参考答案】d+i【参考答案】2*di+dd+id+d【程序填空】题目:本程序用scanf函数输入字符串student, 然后输出,完善程序。#include stdio.hmain() /*FILL*/ _s110; /*FILL*/ scanf(%s,_); printf(%sn,s1); 【参考答案】char【参考答案】s1八【程序填空】题目:用scan
《C语言程序填空(最终版本)》由会员hs****ma分享,可在线阅读,更多相关《C语言程序填空(最终版本)》请在金锄头文库上搜索。