Check A Number is Even or Odd:
Here We will check the number input by user is Even or Odd !
- Input
Number = 5
- Output
Number is Odd
- Code:
import java.util.Scanner;
public class EvenOdd {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int num;
System.out.println("Enter the Number :");
num = scan.nextInt();
if(num % 2 == 0){
System.out.println("Number is Even");
}
else{
System.out.println("Number is Odd");
}
}
}
- Explanation:
Click On Image For Program View
🙏THANKS FOR VISIT🙏
Check A Number is Even or Odd in Java - CodexRitik
Reviewed by CodexRitik
on
July 29, 2020
Rating:
No comments: