# Program to calculate the division of a student according to marks obtained in 4 subjects using C/C++

LEVEL: Beginner

Whats in this post?

1. Code
2. Output
3. Background and Explanation of the code

Code

To copy code: Click “View Source” on the right of this code snippet.

Background and Explanation of the code 1.In the above program , the if-else ladder takes decision based on the value of the percentage of marks (per) calculated and displays the appropriate division.

2.Here the value of the percentage ‘per’ calculated for inputed data 55 44 60 44 comes out to be 50.75. On the bases of this value, the first condition in the if-else-if ladder turns out to be false then it check the second condition (per>=50 && per<60) which turns out to be TRUE so it displays the message Second Division and skips the remaining conditions and finally reaches the end of the program.

On execution of the program the output is shown:

Enter marks of 4 subjects: (Press Enter)
55(Press Enter)
44(Press Enter)
60(Press Enter)
44(Press Enter)
percentage=50.75
Second Division

Important information to beginners:

The above program has been written on bases of the following criteria:
If percentage(%)
a) above or equal to 60 – First Division
b) above or equal to 50 but less than 60 – Second Division
c) above or equal top 35 but less than 50 – Third Division
d) less than 35 – Fail.(Assume maximum marks of each student =100)