google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program to calculate average marks of students - 2nd puc computer science

Write a program to calculate average marks of students

 /*consider an array MARKS[20][5] which stores the marks obtained
by 20 students in 5 subjects. Now write a program to:
a) Find the average marks obtained in each subject
b) Find the average marks obtained by every student
c) Find the number of students who have scored below 50 in their average.
*/

#include<iostream.h>

#include<conio.h>

void main()

{

int marks[20][5],i,j,n,s,total,count=0;

double average;

clrscr();

cout<<"Enter the number of students: ";

cin>>n;

cout<<"Enter the number of subjects: ";

cin>>s;

cout<<"Enter the marks:\n";

for(i=0;i<n;i++)

for(j=0;j<s;j++)

cin>>marks[i][j];

cout<<"Average of subjects:\nsub1\tsub2\n";

for(i=0;i<s;i++)

{

total=0;

for(j=0;j<n;j++)

total=total+marks[j][i];

average=total/n;

cout<<average<<"\t";

}

cout<<"Average of students:\nstudent\tAverage\n";

for(i=0;i<n;i++)

{

total=0;

for(j=0;j<s;j++)

total=total+marks[i][j];

average=total/s;

if(average<50)

count++;

cout<<i+1<<"\t"<<average<<endl;

}

cout<<"Number of students less than average 50 is "<<count;

getch();

}

Write a program to calculate average marks of students Write a program to calculate average marks of students Reviewed by Vision Academy on March 03, 2022 Rating: 5

No comments:

CheckOut

Powered by Blogger.