Write a program to check whether a person is eligible for vote using simple-if, without else.
Answers
Answered by
1
Answer :
import java .util.*;
class vote
{
public static void main ()
{
int age;
String name;
System.out.println("Enter your name");
name=sc.nextLine();
System.out.println("Enter your age");
age=sc.nextInt();
{
if(age>=18)
System.out.println("You are eligible to vote ");
}
if (age<18)
System.out.println("You are not eligible");
}
}
Similar questions