Check Student Pass or Fail
C++
Easy
2 views
Problem Description
A student needs 40 marks to pass. Check if student passed or failed.
Step-by-Step Logic:
1. Take student's marks
2. Compare marks with passing marks (40)
3. If marks >= 40, student passed
4. Otherwise student failed
5. Print result
Official Solution
oid control_q1_pass_fail() {
int marks = 65;
int passingMarks = 40;
cout << "Student marks: " << marks << endl;
if(marks >= passingMarks) {
cout << "Result: PASS" << endl;
} else {
cout << "Result: FAIL" << endl;
}
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!