C Program To Calculate Sum of 5 Subjects and Find Percentage

How To Write a C Program To Calculate Sum of 5 Subjects and Find Percentage in C Programming Language ?


Solution For C Program To Calculate 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("nEnter marks of 5 subjects : ");
scanf("%d%d%d%d%d",&s1,&s2,&s3,&s4,&s5);

sum = s1 + s2 + s3 + s4 + s5;

printf("nSum : %d",sum);

per = (sum * 100) / total;

printf("nPercentage : %f",per);
getch();
}
Output :
Enter marks of 5 subjects : 80 70 90 80 80
Sum : 400
Percentage : 80.00

Tags: C Program to calculate sum of 5 subjects and find percentage, c program to find average marks using array, how to calculate percentage of total marks obtained, c++ program to calculate sum of 5 subjects and find percentage, program to show swap of two no's without using third variable, student mark list program in c using array, a program to find the total salary of employee and salary of employee details, write a program to find out area and perimeter of a rectangle, program to reverse a given number.


Learn More :