Beihang OJ subject: ID1(test a + b)

Topic description

  • Calculate a+b

enter

  • The first number is the number of data groups n, the next n lines, each line contains 2 integers a, b (guaranteed that a, b, a+b are in the int range)

output

  • For each set of data, output a row, which is the value of a+b

input sample

2
1 2
2 3

Sample output

3
5

AC code

#include <stdio.h>
int main(void)
{
    int n;
    int a,b;

    scanf("%d", &n);

    while(n--){
        scanf("%d%d",&a, &b);
        printf("%d\n",(a+b));
    }

    /* // 或用如下for循环代替while循环
    int i;
    for(i=0; i<n; i++){
        scanf("%d%d",&a, &b);
        printf("%d\n",(a+b));
    }
    */

    return 0;
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644633&siteId=291194637