一道很简单的C语言练习题 我想看看是不是我思路有问题

ProblemDescriptionYourtaskistoCalculatea+b.Tooeasy?!Ofcourse!Ispeciallydesignedthepro... Problem Description

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.

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

谁帮我写出这个题目的代码 我比较自己的看一下 谢谢 求不鄙视
展开
 我来答
萧竣闰
2015-04-02 · TA获得超过893个赞
知道小有建树答主
回答量:685
采纳率:81%
帮助的人:184万
展开全部
#include "stdio.h"

void main()

{

int n,i=0,j=0,a[100],x,y;

printf("请输入次数\n");

scanf("%d",&n);

while(i!=n)

{

printf("请输入两个数:\n");

scanf("%d%d",&x,&y);

a[i]=x+y;

i++;

}

while(j<n)
{
getchar();
printf("%d ",a[j]);
j++;
}

}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2015-04-02
展开全部
#include<stdio.h>
main()
{
int a,b;
while(scanf("%d%d",&a,&b)!=EOF)
printf("%d\n\r",a+b);

}
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式