码迷,mamicode.com
首页 > 其他好文 > 详细

hdoj1091

时间:2015-09-13 23:06:32      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

第一次尝试

#include<stdio.h>
#include<stdlib.h>                                             关于0 0终止输入和这个测试用例不处理,不会

int main()
{
    int a,b;
    do
    {scanf("%d%d",&a,&b);
    printf("%d\n",a+b);
    }
    while(a!=0||b!=0);
    return 0;
}

 

第二次尝试

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

 

 

讨论区

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

hdoj1091

标签:

原文地址:http://www.cnblogs.com/zsq2015/p/4805801.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!