oj1089: A+B for Input-Output Practice (II)

来源:互联网 发布:sql批量修改字段值 编辑:程序博客网 时间:2024/04/30 17:20
问题描述:The first line integer means the number of input integer a and b. Your task is to Calculate a + b.
作者:何知令
发表时间:2017年2月16日
输入: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.

代码:

/*问题描述:The first line integer means the number of input integer a and b. Your task is to Calculate a + b.作者:何知令发表时间:2017年2月16日输入: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>#include <stdlib.h>int main(){    int num;    int i;    int a,b;    scanf("%d",&num);    for(i=0;i<num;i++)    {        scanf("%d %d",&a,&b);        printf("%d\n",a+b);    }    return 0;}
程序运行结果展示:

知识点总结:控制结构

学习心得:第二道依旧简单得要死


0 0
原创粉丝点击