Description
Your task is to Calculate a + b.
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, and followed by a blank line.
Sample Input
1 5
10 20
Sample Output
6
30
#include<stdio.h>
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
printf("%d\n\n",a+b);
return 0;
}
#include<stdio.h>
main()
{
int a[100] ,b[100],n;
printf("Please input the number of times that you have to compute n(0<n<100):n=\n(请输入您要计算的次数n:(0<n<100))n=");
scanf("%d",&n);
printf("Please putin the number: a and b :\n");
for (int i = 0; i <n ; i ++ ){
scanf("%d %d",&a[i],&b[i]);
}
for(int j = 0; j <n ; j ++){
printf("%d\n\n",(a[j]+b[j]));
}
}
根据提示输入2,输入1+空格+2回车;输入10 +空格+20回车;得到结果;
#include<stdio.h>
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF)printf("%d\n",n+m);
return 0;
}
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息