云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > (完整版)全国计算机等级考试二级教程--C语言程序设计课后习题答案

(完整版)全国计算机等级考试二级教程--C语言程序设计课后习题答案

  • 62 次阅读
  • 3 次下载
  • 2025/5/3 11:24:58

{ if(x > -5) {

printf(\ } else {

printf(\ } } if(0 == x) {

printf(\ } if(x > 0) { if(x < 10) {

printf(\ } else {

printf(\ } } }

(3)if_else语句 #include

void main() { int x,y;

printf(\ scanf(\ if( x>-5 && x<0 ) {

printf(\ }

else if( x==0 ) {

printf(\ }

else if( x>0 && x<10 ) {

printf(\ } else {

printf(\ } }

(4)switch语句 #include

void main() { int x,y;

printf(\ scanf(\ switch (x) { case -4: case -3: case -2: case -1:

printf(\ break; case 0:

printf(\ break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9:

printf(\ break; default:

printf(\ } } 第五章

一. 选择题

5.1 D 5.2 C 5.3 B 5.4 C 5.5 C 5.6 B 5.7 D 5.8 A 5.9 D 5.10 D

二. 填空题 5.11 5 4 6 5.12 死循环 5.13 -1 5.14 11

5.15 d=1.0 k++ k<=n 5.16 x>=0 x 三. 编程题 5.17 #include void main() { int i; int sig = 1; int sum = 0;

for(i=1; i<=101; i++,i++) {

sum += sig*i; sig *= -1; }

printf(\ } 5.18 (1) #include

void main() { int i;

double m=1.0; double e = 1.0; for(i=1; i<50; i++) { m *= i; e += 1/m; }

printf(\ } (2)

#include

void main() { int i=1; double m=1.0; double e = 1.0; while(1/m >= 0.0004) { m *= i; e += 1/m; i++; }

printf(\ } 5.19 #include

void main() { int year; int col = 0;

for(year=1600; year<=2000; year++) {

if((year%4 == 0 && year0 != 0) || year@0 == 0) {

printf(\ col++; if(col%5 == 0) {

printf(\ } } }

printf(\ } 5.20 #include #define N 7

void main()

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

{ if(x > -5) { printf(\ } else { printf(\ } } if(0 == x) { printf(\ } if(x > 0) { if(x < 10) { printf(\ } else { printf(\ } } } (3)if_else语句 #include void main() { int x,y; printf(\ scanf(\ if( x>-5 && x<0 ) { printf(\ } else if( x==0 ) { printf(\ } else if( x>0 && x<10 ) {

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com