CALCULATE SUM OF 5 SUBJECTS AND FIND PERCENTAGE
In this program we learn how to calculate sum of 5 subjects and find percentage provided by user using C.C program to calculate sum of 5 subjects and find percentage
// Calculate sum of 5 subjects and find percentage
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,sum;
float per;
clrscr();
printf("\n Enter the number of 5 subjects : ");
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
sum = a + b + c + d + e;
per = (sum / 500.0) * 100;
printf("\n The sum of 5 subjects = %d \n The percentage = %.2f %",sum,per);
getch();
}
OUTPUT:
Enter the number of 5 subjects : 51 60 75 64 80
The sum of 5 subjects = 330
The percentage = 66.00 %
The sum of 5 subjects = 330
The percentage = 66.00 %
No comments:
Post a Comment