Java program to find even or odd
Answers
Answered by
0
Explanation:
check whether no. is odd or even
Attachments:
Answered by
3
Answer:
import java.util.*;
class abc{
public static void main (String ar []){
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number");
int a=sc.nextInt();
System.out println((a%2==0)?"Even":"Odd");
}
}
Logic:-
- Accept a number
- Check if it is even or odd
- If even,print "Even"
- else print "odd"
Similar questions