A+B problems

时间:2023-03-09 13:26:26
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来控制多组数据的输入