Computer Science, asked by Anonymous, 1 year ago

Hi guys✌✌

☺This question is only for seniors and the one's who knows about ✨JAVA✨

➡Write a program in JAVA to enter the age of person if age is greater than equals to 18,then the person is eligible for voting.◀◀

✍✍✍✍✍✍✍✍✍✍

❎No irrelevant answers ❎Pls

⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐

Answers

Answered by siddhartharao77
3

Thanks for asking this question.. This is the 1st java code in my life!.

import java.util.*;

class Voting

{

public static void main(String args[])

{

int a,b;

System.out.print("Enter your age : ");

Scanner criteria = new Scanner(System.in);

a = criteria.nextInt();

if(a >= 18)

{

System.out.println("Heya, you are eligible to vote!");

}

else

{

System.out.println("Don't worry!");

}

}

}


Output:

Enter your age : 18

Heya, You are eligible to vote!


Enter your age : 14

Don't worry!



Hope this helps!   ----- > Good Luck!

Similar questions