In this Program, you’ll learn how to find the Average of Subjects.
To properly understand this Program to find Average of Subjects you should know the following:
- Input/Output
Program to find the Average of 5 Subjects
#include<stdio.h> #include<conio.h> void main() { int s1,s2,s3,s4,s5,sum; float avg; clrscr(); printf("\n Enter Subject 1 Marks : "); scanf("%d",&s1); printf("\n Enter Subject 2 Marks : "); scanf("%d",&s2); printf("\n Enter Subject 3 Marks : "); scanf("%d",&s3); printf("\n Enter Subject 4 Marks : "); scanf("%d",&s4); printf("\n Enter Subject 5 Marks : "); scanf("%d",&s5); sum = s1+s2+s3+s4+s5; printf("\n\n THE SUMATION IS %d ",sum); avg = sum/5; printf("\n\n THE AVERAGE IS %.2f",avg); getch(); }
Output
Enter Subject 1 Marks : 41 Enter Subject 2 Marks : 58 Enter Subject 3 Marks : 60 Enter Subject 4 Marks : 70 Enter Subject 5 Marks : 60 THE SUMATION IS 289 THE AVERAGE IS 57.00
Note: In the above Program you can add more subjects, just declare more int and use printf and scanf to take input and display.
This Program can be used in making application for schools, and for other purposes too like making the calculator.
Ask your questions about how to find Average of Subjects in C and clarify your/others doubts by commenting. Documentation.
Please write to us at [email protected] to report any issue with the above content or for feedback.
Related Program: