Home / Programs / Program to calculate sum of 5 subjects and find percentage
🚀 Programming Example

Program to calculate sum of 5 subjects and find percentage

👁 1,472 Views
💻 Practical Program
📘 Step Learning
Program to calculate sum of 5 subjects and find percentage

💻 Program Code

/* Documentation Section
Program to calculate sum of 5 subjects and find percentage.
author: atnyla developer
*/

#include<stdio.h>
#include<conio.h>
void main()
{
	int s1,s2,s3,s4,s5,sum,total=500;
	float per; 
	printf("enter marks of 5 subjects: \n");
	scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);
	sum=s1+s2+s3+s4+s5;
	printf("sum=%d",sum);
	per=(sum*100)/total;
	printf("percentage=%f \n",per); 
}
                        

🖥 Program Output

 
                            

📘 Explanation

📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.