About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Friday, August 30, 2013

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

No comments: