Accountancy, asked by shaikasiabegum12, 9 months ago

Java program to find a person is eligible to vote or not using if else to check person is eligibility to vote​

Answers

Answered by cathy5
9

Answer:

import java.until.scanner

package election

Class age{

public static void main(String arcs[]){

Scanner scan=new Scanner (System.in);

System.out.println(“Enter the age of person”);

into user_age=scan.nextInt();

System.out.println(“The age of person is”+user_age);

if(user_age>18)

{

System.out.println(“You are eligible to Vote”);

}

else{

System.out.println(“You are not eligible to vote”);

}

}

}

Answered by adwaitrane26
3

Answer:

package stringpractice;

public class StringPractice {

   public static void main(String[] args) {

       int age=5;

       if(age>18)

       {

           System.out.println("Eligible to vote");

       }

       else

       {

           System.out.println("Not eligible to vote");

       }        

   }      

}

Explanation:(Without using scanner class)

Similar questions