成都信息工程学院C语言考试题及答案 

loading 分享 2026-8-20 下载文档

visor is ...\\n\、printf(\。

程序的运行效果应类似地如图1所示,图1中的35 15是从键盘输入的内容。 #include #include

int main(void) { }

编写一程序P831.C实现以下功能

某班有40位同学参加考试,成绩(整数)从键盘输入,求全班最高分、最低分以及平均分,并统计该班同学的考试及格率。编程可用素材:printf(\请输入40位同学的成绩:\、printf(\最高分:...最低分:...平均分:...及格率:...。

return 0;

printf(\greatest common divisor is %d\\n\zdGys); printf(\least common multiple is %d\\n\zxGbs); zdGys = min(m, n);

while (m % zdGys != 0 || n%zdGys != 0) { }

zxGbs = max(m, n);

while (zxGbs % m !=0 || zxGbs % n != 0) { }

zxGbs++; zdGys--;

printf(\input two integer numbers: \scanf(\&m, &n); int m, n, zdGys, zxGbs;

程序的运行效果应类似地如图1所示,图1中的99 81 71 81 77 94 100 67 66 44 75 49 47 45 65 74 73 74 63 69 72 77 65 79 84 73 46 62 68 42 75 62 65 66 62 69 44 62 84 77是从键盘输入的内容。 #include

#define SIZE 40

int main(void) {

/*求最大、最小、分数总和,统计及格人数*/ max = scores[0]; min = scores[0]; aver = 0; count = 0;

for (i = 0; i < SIZE; i++) {

if (scores[i] > max) { }

else if (scores[i] < min) {

min = scores[i]; max = scores[i];

/*从键盘接收数据*/

printf(\请输入%d位同学的成绩:\SIZE); for (i = 0; i < SIZE; i++) { }

scanf(\&scores[i]); int scores[SIZE], i; int max, min, count; double aver, rate;

}

aver += scores[i]; if (scores[i] >= 60) { count++;

}

}

/*求平均分和及格率*/ aver = aver / 40; rate = (double)count / 40; /*输出结果*/

printf(\最高分: %d\\n最低分: \\n\max, min, aver, rate*100);

return 0;

}

%d\\n平均分: %.1f\\n及格率: %.0f%%


成都信息工程学院C语言考试题及答案 .doc 将本文的Word文档下载到电脑
搜索更多关于: 成都信息工程学院C语言考试题及答案  的文档
相关推荐
相关阅读