大家帮帮忙呀!!一道C语言题:A+B for Input-Output Practice (III)
题目描述YourtaskistoCalculatea+b.输入Inputcontainsmultipletestcases.Eachtestcasecontainsapa...
题目描述
Your task is to Calculate a + b.
输入
Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.
输出
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
0 0
样例输出
6
30 展开
Your task is to Calculate a + b.
输入
Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.
输出
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
0 0
样例输出
6
30 展开
2个回答
展开全部
#include <stdio.h>
main()
{
int a[100];
int b[100];
int c[100];
int i=0,j=0,k=0;
printf("请输入多个a与b的值,若无则输0 0\n");
scanf("%d %d",a,b);
c[0]=a[0]+b[0];
for(;c[k]!=0;)
{scanf("%d %d",&a[++i],&b[++j]);
c[++k]=a[i]+b[j];}
for(k=0;c[k]!=0;k++)
printf("a+b=%d\n",c[k]);
printf("感谢使用本系统!\n");
}
给你个建议,以后最好不要发英文,一般人懒得看的……
main()
{
int a[100];
int b[100];
int c[100];
int i=0,j=0,k=0;
printf("请输入多个a与b的值,若无则输0 0\n");
scanf("%d %d",a,b);
c[0]=a[0]+b[0];
for(;c[k]!=0;)
{scanf("%d %d",&a[++i],&b[++j]);
c[++k]=a[i]+b[j];}
for(k=0;c[k]!=0;k++)
printf("a+b=%d\n",c[k]);
printf("感谢使用本系统!\n");
}
给你个建议,以后最好不要发英文,一般人懒得看的……
追问
额……我也懒得看实际上~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询