그 이후 줄 부턴 0보다 크고 10000보다 작은 수가 들어가는데 이 수가 n의 배수인지 아닌지 확인하여
예제 출력처럼 출력하는 문제입니다.
예제 입력
3
1
7
99
321
777
0
예제 출력
1 is NOT a multiple of 3.
7 is NOT a multiple of 3.
99 is a multiple of 3.
321 is a multiple of 3.
777 is a multiple of 3.
🔔 Kick Point :
삼항 연산자를 이용하여 편하게 출력하였습니다.
🔔 Code :
#include <iostream>
using namespace std;
int main() {
int n, i; cin >> n;
while (cin >> i && i) {
cout << i << " is" << (i%n ? " NOT" : "")
<< " a multiple of " << n << ".\n";
}
}