Java(Take input from user)
package com.lalita_ent;
import java.util.Scanner;public class Main{
public static void main(String args[]) {
Scanner scan= new Scanner(System.in);
System.out.println("Enter the value of x >>>");
int x= scan.nextInt();
if (x>=18) {
System.out.println("Congratulations!! You are eligible for voting.");
}
else{
System.out.println("Sorry!! You are not eligible for voting.");
}
}
}
Comments