成信大C语言程序设计14,南昌大学信工学院C语言程序设计综合练习.doc

南昌大学信工学院C语言程序设计综合练习

简答题

用N-S图表示判断素数的算法。

阅读以下程序,写出程序的运行结果:

#include

void main()

{

char c1,c2;

c1='a';

c2='b';

c1=c1-32;

c2=c2-32;

printf("%c %c",c1,c2);

}

程序运行结果为__A B__________________

阅读以下程序,写出程序的运行结果:

main()

{

int c=5;

printf("%d,%d,%d\n",c+=c++,c+8,++c);

c=5;

printf("%d\n",(c+=c++,c+8,++c));

c=5;

printf("%d\n",c+=c++,c+8,++c);

}

程序运行结果为_:12,14,6

12

12_

4阅读以下程序,写出程序的运行结果:

main ( )

{

int day,x1,x2;

day=9;

x2=1;

while(day>0){

x1=(x2+1)*2;

x2=x1;

day--;

}

printf(“total=%d\n”,x1);

}

程序运行结果为____________________

阅读以下程序,写出程序的运行结果:

#include

void main()

{

int i;

int f[10]={1,1};

for(i=2;i<10;i++)

f[i]=f[i-2]+f[i-1];

for(i=0;i<10;i++)

{

if(i%5==0) printf("\n");

printf("%12d",f[i]);

}

} 程序运行结果为____________________

阅读以下程序并写出其运行结果

#include

main()

{ int x=1,y=0,a=0,b=0;

switch(x)

{ case 1:

switch(y)

{ case 0: a++; break;

case 1: b++; break;

}

case 2: a++; b++; break;

case 3: a++; b++;

}

printf(“a=%d,b=%d\n”,a,b);

}

程序的运行结果是

阅读以下程序并写出其运行结果

#include

main()

{ int a[ ]={1,2,3,4},y,*p=&a[3];

--p; y=*p; printf(“y=%d\n”,y);

}

程序的运行结果是

阅读以下程序并写出其运行结果

#include

void fun(int *s, int nl, int n2)

{ int i, j, t ;

i=nl; j=n2;

while(i

}

main()

{ int a[10]={1,2,3,4,5,6,7,8,9,0},k;

fun(a,0,3); fun(a,4,9); fun(a,0,9);

for(k=0;k<10;k++)printf(“%d”,a[k]); printf(“\n”);

}

程序运行的结果是

阅读以下程序并写出其运行结果

#include

int f(int x)

{ int y;

if(x==0||x==1) return (3);

y=x*x-f(x-2);

return y;

}

main()

{ int z;

z=f(3);

printf(“%d\n”,z);

}

程序的运行结果是

阅读以下程序并写出其运行结果

#include

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值