Answer to Question #275032 in C++ for Nice

Question #275032

Write a program that accepts grade as input from the user and stores these grades in twodimensional array with dimension of 5 rows and by 5 columns. Then count the number of grades that

passed and the number of grades that failed. Grade that pass must be greater or to equal to 80.


Enter the grades: 90 95 78 89 88 71 72 79 81 82 77 74 78 88 91 73 77 75 84 98 76 89 71 87 73 79


There are 12 that passed.

There are 13 that failed.


1
Expert's answer
2021-12-03T06:28:01-0500
#include<iostream>

using namespace std;

int main()
{
	int arr[5][5];
	int passed=0;
	int failed=0;
	cout<<"Enter the grades: ";
	for(int i=0;i<5;i++)
	{
		for(int j=0;j<5;j++)
		{
			cin>>arr[i][j];
			if(arr[i][j]>=80)passed++;
			else failed++;
		}
	}
	cout<<"\nThere are "<<passed<<" that passed.";
	cout<<"\nThere are "<<failed<<" that failed.";	
}

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