Write a program to input from user (5 subjects) sum,average
Program:
#include<stdio.h> #include<conio.h> void main() { int marks,sub,count,sum=0; float avg=0.0; printf("Enter number of subjets\n"); scanf("%d",&sub); printf("Enter %d Subjects marks\n",sub); for(count=1;count<=sub;count++) { scanf("%d"&marks); sum=sum+marks; } avg=sum/sub; printf("sum=%d\nAverage =%0.2f\n",sum,avg); }
Output:
Enter number of subject 5 Enter 5 Subject marks 80 74 87 86 78 sum=405 Average=81.00
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Program:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer