HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C Program to Enter Marks of Five Subjects and calculate Total, Average and Percentage ?


Q:- Write a C Program to Enter Marks of Five Subjects and Calculate Total, Average and  
        Percentage ?
Input

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float eng,phy,che,math,comp;
float total,average,percentage;
clrscr();
printf("Enter Marks of Five Subjects=");
scanf("%f%f%f%f%f",&eng,&phy,&che,&math,&comp);
total = eng+phy+che+math+comp;
average = total/5.0;
percentage =  (total/500.0)*100;
printf("Total Marks =%.2f",total);
printf("Average Marks =%.2f",average);
printf("Percentage =%.2f",percentage);
getch();
       }


Output

Enter Marks of Five Subjects =
95
76
85
90
89
Total Marks = 435.00
Average Marks = 87.00
Percentage = 87.00%

Comments