Problem F: 零起点学算法42——多组测试数据输出II

#include<stdio.h>
int main()
{
    int a,b,c,s,t=0;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
        s=a+b+c;
        if(t>0)
        printf("\n");
        printf("%d\n",s);
        t++;
    }
    return 0;
}

对于每一组数据输入后先处理然后输出结果,再输入第2组数据, 输出数据之间要求有一个空行

int main()
{
    int a,b,c,t=0;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
       c=a+b;
       if( t>0) printf("\n");
       printf("%d\n",c);//注意后面的\n
       t++;

    }
}
posted @ 2018-11-19 16:32  MichaelCecil  阅读(637)  评论(0编辑  收藏  举报