// Challenge: Candy Division
// There are 3 friends and N candies.
// Chef wants to divide all the candies equally among the 3 friends.
// If all 3 friends get the same number of candies,
// there will be no fight.
// Your task is to check whether it is possible
// to divide all N candies equally among the 3 friends.
// If it is possible, print:
// YES
// Otherwise, print:
// NO
// Input Format:
// The first line contains an integer T.
// T represents the number of test cases.
// Each test case contains one integer N.
// N represents the number of candies.
// Constraints:
// 1 <= T <= 100
// 1 <= N <= 100
// Output Format:
// For each test case,
// print YES if N candies can be divided equally among 3 friends.
// Otherwise, print NO.
// Sample Input:
// 4
// 3
// 4
// 2
// 6
// Sample Output:
// YES
// NO
// NO
// YES
// Explanation:
// Test Case 1:
// N = 3
// 3 candies can be divided equally among 3 friends.
// Each friend gets 1 candy.
// Therefore, print YES.
// Test Case 2:
// N = 4
// 4 candies cannot be divided equally among 3 friends.
// Therefore, print NO.
// Test Case 3:
// N = 2
// 2 candies cannot be divided equally among 3 friends.
// Therefore, print NO.
// Test Case 4:
// N = 6
// 6 candies can be divided equally among 3 friends.
// Each friend gets 2 candies.
// Therefore, print YES.
// Hint:
// Think about how the % operator can tell us
// whether a number is exactly divisible by 3.
#include <iostream>
using namespace std;
int main() {
int T;
cin>>T;
for (int i=0;i<T;i++){
int N;
cin>>N;
if(N%3==0){
cout<<"YES"<<endl;
}
if(N%4==0){
cout<<"yes"<<endl;
}
if(N%14==0){
cout<<"yes"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: