Write a program to print Odd Even and Divisibility by 3
Take n as an integer input. After this you will be given n numbers as integer inputs and you have to print each time if the number is Even or Odd. And Print “Divisible by 3” if the number is a multiple of 3 and print “Not Divisible by 3” if the number is not a multiple of 3
Input Format
N as an Integer Input
N numbers as an Integer Input
Constraints
1<=N<=1000
1<=K<=1000
Output Format
As Described in Problem Statement
Sample Input 0
5
9
11
2
6
15
Sample Output 0
Odd Divisible by 3
Odd Not Divisible by 3
Even Not Divisible by 3
Even Divisible by 3
Odd Divisible by 3
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=1; i<=n; i++){
int x=sc.nextInt();
if(x%2==0){
if(x%3==0)
System.out.println("Even Divisible by 3");
else
System.out.println("Even Not Divisible by 3");
}
else{
if(x%3==0)
System.out.println("Odd Divisible by 3");
else
System.out.println("Odd Not Divisible by 3");
}
}
}
}