题目链接
题目描述
编程实现输入两个整数a,b,当0<&#61;a&#43;b<&#61;3时输出YES,当a&#43;b>&#61;4时输出NO&#xff0c;当a&#43;b<0时输出negative
Input
输入两个整数a,b&#xff0c;以空格隔开
Output
根据判断结果输出“YES”“NO”或“negative”
Sample Input
7 -1
Sample Output
NO
思路
输入两个整数a,b,当0<&#61;a&#43;b<&#61;3时输出YES,当a&#43;b>&#61;4时输出NO&#xff0c;当a&#43;b<0时输出negative。
C&#43;&#43;代码&#xff1a;
#include
using namespace std;
int main()
{int a, b;while(cin >> a >> b){if(0 <&#61; a &#43; b && a &#43; b <&#61; 3) cout << "YES" << endl;else if(a &#43; b >&#61; 4) cout << "NO" << endl;else if(a &#43; b < 0) cout << "negative" << endl;}return 0;
}