PTA 7-219 sdut-C语言实验-A+B for Input-Output Practice (不确定次数循环)
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
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
代码:
#include <stdio.h>
int main(){
int a, b; //定义两个整数
while(~scanf("%d %d", &a, &b)){ //处理到文件尾
printf("%d\n", a + b);
}
return 0;
}
解题思路:
略
归属知识点:
处理到文件尾结束标志