Program to calculate sum of 5 subjects and their percentage

Hello friends, in this example, you will learn how to calculate sum of 5 subjects and their percentage in C programming language using following topics:
  1. Data Types
  2. Variables And Constants
  3. Operators


Output:

Enter marks of five sub:
84
76
65
90
70
Total marks= 385
Percentage= 77

Description of Program:

  • Input marks of five subjects in variables that say s1,s2,s3,s4 and s5.
  • Culculate sum of all subject and store it in total. i.e, Total= s1+s2+s3+s4+s5.
  • Divide total marks of all subject by total number of subject or divid total marks of all subject divided by 500 and multiply them by 100 to find the percentage. i.e,  (total marks/5)= %.  Or (total marks/500)*100= %
  • Overall, print the total values and percentage.

Post a comment

2 Comments