Answer to Question #330284 in C++ for smoak

Question #330284

consider an array marks[20][5]which stores the marks obtained by 20 students in 5 subjects



1
Expert's answer
2022-04-18T09:11:59-0400
#include <iostream>

using namespace std;

int main()
{
	const int N = 20, M = 5;
	float marks[N][M];
	cout << "Please, enter an array of subjects:\n";
	for (int i = 0; i < N; i++)
	{
		cout << "Please, enter 5 marks for the "<<i+1<<" student:"<<endl;
		for (int j = 0; j < M; j++)
		{
			cout << "Please, enter a mark for the " << j + 1 << " subject: ";
			cin >> marks[i][j];
		}
	}
	cout << endl;
	cout << "Marks of students:\n";
	for (int i = 0; i < N; i++)
	{
		cout << i+1 << " student   ";
		for (int j = 0; j < M; j++)
		{
			cout<<marks[i][j]<<" ";
		}
		cout << endl;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS