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.
Sample Program:
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.
#include <iostream>
using namespace std;
int main()
{
int N;
int count=1;
cout<<"enter the size of the array: ";
cin >> N;
cout<<"Enter the grades: ";
int arr[N];
for(int i=1;i<N;i++){
cin>>arr[i];
}
for(int i=1;i<N;i++){
if(arr[i]>80){
count+=1;
cout<<"Students that pass are: "<<count;
cout<<"\nStudents that failed are: "<<N-count;
}
}}
Comments
Leave a comment