Computer Science, asked by Jenisha222, 11 months ago

write a java program to input age. If the age is 18 or above print 'yes'. If the age is less than 18, calculate after how many years the person will be able to vote​

Answers

Answered by nanhaykumar
26

public class Main

{

public static void main(String[] args) {

int age;

Scanner sc = new Scanner(System.in);

System.out.println("Enter the year you want to check : ");

age = sc.nextInt();

//check voting eligibility

if (age>=18)

{

System.out.println("person is eligible for voting");

}

else

{

System.out.println("person is not eligibal for voting\n");

}

}

}

Answered by ishitarathore11
4

Answer:

class Eligibility

{

public static void main (String args[])

{

Scanner a = new Scanner (System.in)

int age;

age = a.nextInt();

if (age<=18)

{

System.out.println("Eligible");

}

else

{

System.out.println("Not Eligible");

Similar questions