Monday, June 18, 2012

To calculate sum and percentage marks obtained by a student

/* To calculate sum and percentage marks obtained by a student */
#include<stdio.h>

#include<conio.h>

void main()

{

 int m1,m2,m3,m4,m5;

 float total,percent;

 clrscr();

 /* To calculate sum and percentage */

 printf("Enter the marks in 5 subjects:\n");

 scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5);

 total=m1+m2+m3+m4+m5;

 percent=total/500*100;

 printf("\n Total marks obtained by student=%f",total);

 printf("\n Percentage=%f",percent);

 getch();

}

 

OUTPUT

Enter the marks in 5 subjects:

94

96

84

78

88

 

 Total marks obtained by student=440

 Percentage=88.000000
 
 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.