永发信息网

难题,C语言高手进

答案:3  悬赏:40  手机版
解决时间 2021-04-29 05:45
  • 提问者网友:且恨且铭记
  • 2021-04-28 21:36

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

最佳答案
  • 五星知识达人网友:杯酒困英雄
  • 2021-04-28 22:51

#include<stdio.h>


int main()


{


int a,b;


while(scanf("%d%d",&a,&b)!=EOF)


printf("%d\n\n",a+b);


return 0;


}

全部回答
  • 1楼网友:不如潦草
  • 2021-04-29 00:40

#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回车;得到结果;

  • 2楼网友:第四晚心情
  • 2021-04-28 23:16
#include<stdio.h> int main() { int n,m; while(scanf("%d%d",&n,&m)!=EOF)printf("%d\n",n+m); return 0; }
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯