-
Notifications
You must be signed in to change notification settings - Fork 243
Description
Description:
This issue is for adding a Java solution to determine whether cars with given numbers can run on Sunday based on the sum of odd and even digits. The car number is allowed to run if:
The sum of even digits is divisible by 4 or
The sum of odd digits is divisible by 3.
Problem Description:
Input: The first line contains an integer N (number of cars). The following N lines each contain a car number.
Output: For each car number, print "Yes" if it is allowed to run on Sunday, otherwise print "No."
Constraints:
N <= 1000 (Number of cars).
Car number is an integer between 0 and 1,000,000,000.
Output Format
N lines each denoting "Yes" or "No" depending upon whether that car will be allowed on Sunday or Not !
Sample Input
2
12345
12134
Sample Output
Yes
No
Explanation
1 + 3 + 5 = 9 which is divisible by 3
1 + 1 + 3 = 5 which is NOT divisible by 3 and 2+4 = 6 which is not divisble by 4.