A+B problems

Posted Rohlf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A+B problems相关的知识,希望对你有一定的参考价值。

这几道习题大概是ACM输入输出格式的普及

P1:
-------------------------------------------------------------------------------------------------------------------------------------------------
Input:
The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.
Output
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.

Sample Input
1 5
10 20

Sample Output
6
30
-------------------------------------------------------------------------------------------------------------------------------------------------
Code:
int main()
{
int a,b;
while("scanf("%d %d",&a,&b)==2")
printf("%d\n",a+b);
return 0;
} //简单的用while来控制多组数据的输入

以上是关于A+B problems的主要内容,如果未能解决你的问题,请参考以下文章