In this example, the if-else-if ladder takes decision based on the value of percentage of marks (percentage) calculated and displays the appropriate division. Here, the value of the percentage calculated for inputted data 80 50 75 evaluates to be 68.33. On the basis of this value, the first condition in if-else-if ladder (percentage>=60 & percentage<100) which evaluates to be true so it displays the message First Division and skip the remaining conditions.
Annual exam result is to be conducted for 20 students for 3 subjects. Write a program to read the data and determine the following:
- Collect the exam result data for individual student.
- Calculate all the obtained marks from three subjects for each student.
- Put them in condition statement and get the grading and percentage of students.
- The Student who get clear the required condition for Division placement.
Here is the C program to Find the Percentage or marks of students. This C program is an example to use Control statements.
printf("Enter 3 Nos.");
printf("You are 1st :");
printf("You are 2nd");
printf("You are 3rd");
printf("You are Fail");