C语言练习题(山东科技大学吐血整理)

内容发布更新时间 : 2025/5/26 9:26:30星期一 下面是文章的全部内容请认真阅读。

Sample Output 2 3 4 8 9 10 14 15 Answer

#include int main() { int k,m,n,a,i=1; scanf(\ if(m

16、A+B ProblemT

Description

计算a+b,0<=a,b<1000。 Input

输入有多对整数a和b组成,每对a和b占一行,a,b用空格分开。 Output

每行输出一个a+b的值,顺序与输入对应。 Sample Input 1 2 10 20

Sample Output 3 30

Answer

#include int main() { int a,b; while(scanf(\ { printf(\ } return 0; }

17、A+B Problem (II) : Input/Output Pratice

Description

计算a+b,0<=a,b<1000。 Input

输入的第一行是一个整数N,后面有N对整数a和b,每对a和b占一行,a,b用空格分开。 Output

每行输出一个a+b的和,顺序与输入对应。 Sample Input 2 1 2 10 20

Sample Output 3 30

Answer

#include int main() { int a[1000],b[1000],N,i; scanf(\ for(i=1;i<=N;i++) scanf(\ for(i=1;i<=N;i++) printf(\ return 0; }

18、成绩的等级

Description

把百分制的考试成绩转换成五级制的成绩: 90~100:Excellent 80~89:Good 70~79:Average 60~69:Pass 0~59:Failing

不在0~100之间的输入是非法数据,输出“Error”。 Input

输入多行,每行一个整数。 Output

输入所对应的成绩等级。 Sample Input -1 81 92 35 68 72 100

Sample Output Error Good Excellent Failing Pass Average Excellent Answer

#include int main() {

int score; while(scanf(\ { if (score<0||score>100) printf(\ else {

switch (score/10) { case 0: case 1: case 2: case 3: case 4: case 5:printf(\ case 6:printf(\ case 7:printf(\ case 8:printf(\ case 9: case 10:printf(\

>>展开全文<<
12@gma联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4 ceshi