-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path69.cpp
36 lines (33 loc) · 965 Bytes
/
69.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Write a Program in C++ to Compute the Average Marks of 50 Students in the Class. Take Necessary Assumptions.
#include<iostream>
using namespace std;
int main()
{
struct Student
{
int sagar;
int sub[10];
};
struct Student st[50];
int i,j,n,m,total;
float avg;
cout<< "Enter the Number of Students in the Class: ";
cin>> n;
cout<< "\nEnter the Number of Subjects each Student has Taken: ";
cin>> m;
for(i=0;i<n;i++)
{
total = 0;
cout<< "\nEnter the Roll No. of" << i+1 << "Student: ";
cin>> st[i].sagar;
cout<< "\nEnter the Marks: ";
for(j=0;j<m;j++)
{
cout<< "\nEnter the Marks of" << j+1 << "Subject: ";
cin>> st[i].sub[j];
total = total + st[i].sub[j];
}
avg = (float) total/m;
cout<< "\nAverage Marks of" << i+1 << "Student: " <<avg << endl;
}
}