Gadgets 4 Students Career Guide Free Tutorials  Go to Your University  Placement Preparation 
1 like 0 dislike
32.7k views
in GTU B.E. (CSE-I-Sem) Programming For Problem Solving Lab by Goeduhub's Expert (7.1k points)

Write a program to calculate average and total of 5 students for 3 subjects using C programming

1 Answer

1 like 0 dislike
by Goeduhub's Expert (7.1k points)
edited by
 
Best answer

Sum and Average Of Subjects

In this program we are going to calculate total and average of 5 students marks in 3 subjects. For this we are going to use 3 arrays to store marks of students in 3 subjects.

To learn basics of array Click Here.

Example :

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
float avg[5],s1[5],s2[5],s3[5],sum[5];
clrscr();
for(i=0;i<5;i++)
{
printf("\nEnter marks of students %d in 3 subjects:",i+1);
scanf("%f%f%f",&s1[i],&s2[i],&s3[i]);
}
for(i=0;i<5;i++)
{
sum[i]=s1[i]+s2[i]+s3[i];
avg[i]=sum[i]/3;
}
for(i=0;i<5;i++)
printf("\nStudent %d's marks:\nTotal : %.2f\nAverage : %.2f",i+1,sum[i],avg[i]);
getch();
}

Output :

Output of above program showing average of student marks


For More GTU C Programming Lab Experiments Click Here

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...