Menu

Read age of a person and display whether he/she is eligible for voting or not.


import java.util.*;
class Check_eligibility_voting{
public static void main(String args[]){
Scanner sc= new Scanner(System.in);
System.out.println("Please enter your age");
int age= sc.nextInt();

if(age>18) System.out.println("You are eligible for voting");
else System.out.println("You are not eligible for voting");

}}