欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)7-220 sdut-C语言实验——两个数比较

发布时间:2024/3/12 编程问答 35 豆豆
生活随笔 收集整理的这篇文章主要介绍了 7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)7-220 sdut-C语言实验——两个数比较 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

目录

7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)

7-220 sdut-C语言实验——两个数比较


7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)

分数 10

全屏浏览题目

切换布局

作者 马新娟

单位 山东理工大学

Your task is to Calculate a + b.

Too easy?! Of course! I specially designed the problem for acm beginners.

You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim.

输入格式:

The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.

输出格式:

For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.

输入样例:

1 5 10 20

输出样例:

在这里给出相应的输出。例如:

6 30

代码如下:

#include "stdio.h" int a,b; int main() {while(scanf("%d%d",&a,&b)!= EOF){printf("%d\n",a+b);} }

 

7-220 sdut-C语言实验——两个数比较

分数 10

全屏浏览题目

切换布局

作者 马新娟

单位 山东理工大学

求2个数中较大者。

输入格式:

第一行为测试的数据组数N,接下来的N行分别是两个待比较的整数。

输出格式:

输出N行,每一行的值为每组数中较大的整数。

输入样例:

2 1 2 15 10

输出样例:

在这里给出相应的输出。例如:

2 15

代码如下: 

#include <stdio.h> int main(){int a;int x,y;scanf("%d",&a);for(int i = 0; i < a; i++){scanf("%d%d",&x,&y);x > y? printf("%d\n",x):printf("%d\n",y);}return 0; }

 

总结

以上是生活随笔为你收集整理的7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)7-220 sdut-C语言实验——两个数比较的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。