Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

C Program to calculate sum of 5 subjects and find percentage

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program to calculate the sum of 5 subjects and find percentages in C Programming with practical program code and step-by-step full complete explanation.

C Program to calculate sum of 5 subjects and find percentage

C Program to calculate the sum of 5 subjects and find percentage.

#include <stdio.h>
#include <conio.h>

void main()
{
	int s1,s2,s3,s4,s5,sum,total=500;
	float per;
	clrscr();

	printf("Enter marks of 5 subjects: ");
	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",per);

	getch();
}

Output

Enter marks of 5 subjects: 65
65
50
60
60
Sum = 300
percentage = 60.000
Here in the above program we first include the header files and then in the main function, we declare the variables and use the clrscr() function to clear the output screen. after that, we use the sum variable to store the sum of all subjects and then print the value of the sum on the output screen.
After that, we find the percentage of the subjects using the sum variable and store it in the per variable, and then print it on the output screen.
c coding problems

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes