Skip to content

Add Java Solution for Odd-Even Rule in Delhi Problem #462

@Prathamesh-1011

Description

@Prathamesh-1011

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions