题目 1086: A+B for Input-Output Practice (II)
题目描述:
The first line integer means the number of input integer a and b. Your task is to Calculate a + b.
输入:
Your task is to Calculate a + b. The first line integer means the numbers of pairs of input integers.
输出:
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.
思路:题目不难我们可以定义二维数组进行处理。
第一行输入的是组的量,每组仅有两个数 ,输入后用循环处理即可。
#include<stdio.h>
int main()
{
int i,k,j;
int a[i][2];
scanf("%d",&i);
for(j=0;j<i;j++)
{
scanf("%d %d",&a[j][0],&a[j][1]);
}
for(j=0;j<i;j++)
{
printf("%d\n",a[j][0]+a[j][1]);
}
return 0;
}
....哎,但我这道题打了两遍,开始考虑错了。我理解成了考虑成输入
一组数,第一行是这组数的量。阅读理解不好啊啊啊啊、、、、、