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
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
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
India Languages,
7 months ago
Math,
7 months ago
Science,
1 year ago
Sociology,
1 year ago
Math,
1 year ago