Check Admission Eligibility
This program checks admission eligibility based on marks and entrance exam score.
Problem Statement
Write a Java program that checks if a student is eligible for admission based on marks and entrance exam score.
Source Code
| 1 | public class AdmissionEligibility { |
| 2 | public static void main(String[] args) { |
| 3 | int marks = 85; |
| 4 | int examScore = 70; |
| 5 | if(marks >= 80) { |
| 6 | if(examScore >= 60) { |
| 7 | System.out.println("Eligible for admission - Eduinq"); |
| 8 | } else { |
| 9 | System.out.println("Not eligible: Low exam score - Eduinq"); |
| 10 | } |
| 11 | } else { |
| 12 | System.out.println("Not eligible: Low marks - Eduinq"); |
| 13 | } |
| 14 | } |
| 15 | } |
Program Output
Eligible for admission - Eduinq
Explanation
The program first checks if marks are at least 80. - If true, it then checks if the entrance exam score is at least 60. - Only if both conditions are satisfied, the student is eligible. - Otherwise, it prints the reason for ineligibility. - This demonstrates nested if statements where one condition depends on another, useful for multi-factor eligibility checks in academic admissions. Conclusion: Shows how nested if can handle admission eligibility checks.