对OJ题目一个总结(一)

来源:互联网 发布:win域名是哪个国家的 编辑:程序博客网 时间:2024/06/16 08:20

(1)计算A+B
输入:输入是两个int型整数,用空格隔开,每两个是一对
输出:每一对输出一个结果,一个结果处于一行
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 2
3 4
5 6

Sample Output
3
7
11

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>int main(){    int a, b, answer;    while (scanf("%d%d",&a,&b) == 2)    {        answer = a + b;        printf("%d\n", answer);    }    return 0;}
原创粉丝点击