wu


私信TA

用户名:cncfvc

访问量:215798

签 名:

读研狗没有时间刷题了~~

等  级
排  名 2
经  验 36090
参赛次数 8
文章发表 265
年  龄 25
在职情况 学生
学  校 电子科技大学
专  业 通信工程

  自我简介:

写代码 真好玩 ~



参考代码:

#include<stdio.h>
int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
	   if(a==0&&b==0)
		   break;
	   else

	   printf("%d\n",a+b);
	}
	return 0;
}


 

0.0分

7 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

感觉用continue更符合题意吧,虽然样例里0 0在末尾,但是题目中说的是若为0 0,则不处理,0 0 可以在中间
2019-05-01 14:50:09
#include<stdio.h>
int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b) && (a!=0||b!=0))
	{
		printf("%d\n",a+b);
	}
	return 0;
}
2019-01-23 12:49:52
#include<stdio.h>
int main()
{
	int n,i;
	while(scanf("%d %d",&n,&i)!=EOF)
	{
		if(n==0||i==0)
		  break;
		else
		  printf("%d\n",n+i);
	}
	return 0;
}
题目中不是整数中有一个0也不行吗,为啥我这样错了,求大神
2018-11-30 19:22:02
#include<stdio.h>
int main()
{
	int a, b;
	while(scanf("%d%d",&a,&b) == 2)
	{
		if(a!=0&&b!=0)
		printf("%d\n",a+b);
		else 
		break;
	}
	return 0;
}
2018-11-09 17:02:56
能建议下EOF怎么用吗
2018-07-17 15:12:40
  • «
  • 1
  • »