计算机二级C语言考试题库
校园网?新视野育二视教C上机考视视视视料 ;,
校园网?新视野育二视教C上机考视视视视料
;共50套视目,
校园网?新视野育上机考视视视视料 教第1套 ******/
zero=count;
return max;
}
main()
{ unsigned n; int zero,max;
printf("\nInput n(unsigned): "); scanf("%d",&n);
max = fun( n,&zero );
printf("\nThe result: max=%d zero=%d\n",max,zero);
}
3、程序视视视 校园网?新视野育上机考视视视视料教
#include <>
double fun(int n)
{
本视料视供考前视视使用~视勿视入考视4
校园网?新视野育二视教C上机考视视视视料 ;,}
main()
{ int n; double s;
printf("\nInput n: "); scanf("%d",&n);
s=fun(n);
printf("\n\ns=%f\n\n",s);}
校园网?新视野育上机考视视视视料 教第3套
1、程序空视 填
#include <>
unsigned long fun(unsigned long n){ unsigned long x=0; int t;
while(n)
{ t=n%10;
/**********found**********/
if(t%2==__1__)
/**********found**********/
x=__2__+t;
/**********found**********/
n=__3__;
}
return x;
}
main()
{ unsigned long n=-1;
while(n>99999999||n<0)
{ printf("Please input(0<n<100000000): "); scanf("%ld",&n); }
printf("\nThe result is: %ld\n",fun(n));
}
2、程序修改视 校园网?新视野育上机考视视视视料教
本视料视供考前视视使用~视勿视入考视5
校园网?新视野育二视教C上机考视视视视料 ;,#include <>
void fun (long s, long *t){ int d;
long sl=1;
/************found************/
t = 0;
while ( s > 0)
{ d = s%10;
/************found************/
if (d%2 == 0)
{ *t = d * sl + *t;
sl *= 10;
}
s /= 10;
}
}
main()
{ long s, t;
printf("\nPlease enter s:"); scanf("%ld", &s);
fun(s, &t);
printf("The result is: %ld\n", t);}
3、程序视视视 校园网?新视野育上机考视视视视料教
#include <>
void fun(char p1[], char p2[]){
本视料视供考前视视使用~视勿视入考视6
校园网?新视野育二视教C上机考视视视视料 ;,}
main()
printf("Enter s1 and s2:\n") ;
scanf("%s%s", s1, s2) ;
printf("s1=%s\n", s1) ;
printf("s2=%s\n", s2) ;
printf("Invoke fun(s1,s2):\n") ;
fun(s1, s2) ;
printf("After invoking:\n") ;
printf("%s\n", s1) ;
}
校园网?新视野育上机考视视视视料 教第4套
1、程序空视 填
#include <>
#define M 3
#define N 4
void fun(int (*a)[N])
{ int i=0,j,find=0,rmax,c,k;
while( (i<M) && (!find))
{ rm
计算机二级C语言考试题库 来自淘豆网www.taodocs.com转载请标明出处.