write a program to input marks of 5 subjects english maths and science each out of hundred calculate total marks display the message eligible if total marks is above 240 and marks in english is 80 or above display the message not "ELIGIBLE "
Answers
Answer:
Explanation:
Example for Nested If in Java Programming
package ConditionalStatements;
import java.util.Scanner;
public class NestedIf {
private static Scanner sc;
public static void main(String[] args) {
int age;
sc = new Scanner(System.in);
System.out.println(" Please Enter you Age: ");
age = sc.nextInt();
if (age < 18) {
System.out.println("You are Minor.");
System.out.println("You are Not Eligible to Work");
}
else {
if (age >= 18 && age <= 60 ) {
System.out.println("You are Eligible to Work");
System.out.println("Please fill in your details and apply");
}
else {
System.out.println("You are too old to work as per the Government rules");
System.out.println("Please Collect your pension!");
}
}
System.out.println("\nThis Message is coming from Outside the IF ELSE STATEMENT");
}
}
OUTPUT 1: From the screenshot below, you can observe that We entered the age of 16. Here, the first If condition is TRUE. So, the statements inside the first if block will execute.