.
.
.
.
(^o^)Just kidding (^o^)
Here's my question ⏩⏩
●The age should be >= 18
●The nationality should be Indian.
HINT:- Use if-else-if statement for this.
Answers
Answered by
1
.
.
➖➖➖➖➖➖➖➖➖➖➖⬇️
import java.util.*;
class abc
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter your age")
int age=sc.nextInt();
if(age>=18)
{
System.out.println("Eligible for voting");
}
else
{
System.out.println("Not eligible for voting");
}
}
}
Thanks. ;-)
Answered by
4
<html>
<head>
<title>Eligible or not</title>
<script type="text/javascript">
function nationality()
{
var age;
age=Number(document.getElementById("Age").value);
if(age >= 18)
{
prompt(age,"You are indian");
}
else
{
prompt(age,"You are not indian");
}
}
</script>
</head>
<body>
<form>
Enter age:
<input id="Age" name="Age">
<br>
<button onclick="nationality()"> Click </button>
</form>
</body>
</html>
Hope it helps!
Attachments:
Similar questions
English,
7 months ago
Computer Science,
7 months ago
Math,
7 months ago
Social Sciences,
1 year ago
Science,
1 year ago
Physics,
1 year ago
Math,
1 year ago