+ 2

Write a java program to input a number and display it is even or odd.

25th Jun 2018, 2:03 PM
Vidhi Seth
Vidhi Seth - avatar
4 Answers
+ 5
Vidhi Seth once try it by yourself. If you face any problem then we will help you. All the best.. 👍
25th Jun 2018, 2:07 PM
Random
Random - avatar
+ 2
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int input = Integer.valueOf(scan.nextLine()); if (input % 2 == 0) System.out.println("Even"); else System.out.println("Odd"); } }
26th Jun 2018, 2:13 PM
ReimarPB
ReimarPB - avatar
+ 1
i tried nd i hve done it. thnk u so much. Sanjeevini Kranthi
25th Jun 2018, 2:13 PM
Vidhi Seth
Vidhi Seth - avatar
+ 1
Can anyone please explain the meaning of line after Scanner (System.in); ?
7th Jul 2018, 4:01 AM
Himanshu Digrase
Himanshu Digrase - avatar