write a program to take age as input from user and print you are eligible to vote if age is equal to 18 in java
Answers
Answered by
2
import java.util.Scanner;
public class Voter
{
public static void main(String[] args)
{
int age;
Scanner demo = new Scanner(System.in);
System.out.print("Enter age: ");
age = demo.nextInt();
if(age>=18)
{
System.out.println("You are eligible to vote.");
}
else
{
System.out.println("Wait for some time");
} }}
Hope this helps!
public class Voter
{
public static void main(String[] args)
{
int age;
Scanner demo = new Scanner(System.in);
System.out.print("Enter age: ");
age = demo.nextInt();
if(age>=18)
{
System.out.println("You are eligible to vote.");
}
else
{
System.out.println("Wait for some time");
} }}
Hope this helps!
Similar questions