一期作業第8題

題目:
This problem is also a A + B problem,but it has a little difference,you should determine does (a+b) could be divided with 86.For example ,if (A+B)=98,you should output no for result.
Input
Each line will contain two integers A and B. Process to end of file.
Output
For each case, if(A+B)%86=0,output yes in one line,else output no in one line.
Sample Input
1 1
8600 8600
Sample Output
no
yes
翻譯版:
這個問題也是一個A+B問題,但是它有一點不同,你應該確定是否(a+b)可以除以86。例如,如果(A+B)=98,你應該爲結果輸出no。

輸入

每一行將包含兩個整數A和B進程到文件結束。

產量

對於每一種情況,如果(A+B)% 86=0,則在一行中輸出“是”,否則在一行中輸出NO。

樣本輸入

1 1

8600 8600

樣本輸出

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		cin >> a >> b;
		if ((a + b) % 86 == 0)
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
	return 0;
}```
解釋:
用了if函數得到不同的結果

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章