A + B Problem
Problem Description
Calculate
A + B.
Input
Each line will contain two integers
A and
B. Process to end of file.
Output
For each case, output
A + B in one line.
Sample Input
1 1
Sample Output
2
看了讨论区我才知道原来是可以循环输入的那种,谨记
while(scanf("%d%d",&a,&b)!=EOF)
源代码
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,d=0;
while(scanf("%d%d",&a,&b)!=EOF){
d=a+b;
printf("%d\n",d);
}
return 0;
}