Answer to Question #301577 in C++ for Ismail

Question #301577

Given an array A (8,8). Find the sum and the number of positive elements, located below the main diagonal the smallest element of the array (minimum).

please help answer


1
Expert's answer
2022-02-23T06:24:12-0500


#include <iostream>


using namespace std;
int main() {
	int A[8][8];
	int sumNumberPositiveElements=0;


	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			cout<<"Enter number ["<<i<<"]"<<"["<<j<<"]: ";
			cin>>A[i][j];
		}
	}
	int smallestElementArray=A[0][0];
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(i>j){
				sumNumberPositiveElements+=A[i][j];
			}
			if(smallestElementArray>A[i][j]){
				smallestElementArray=A[i][j];
			}
		}
	}
	cout<<"\nSum of elements below the diagonal: "<<sumNumberPositiveElements<<"\n";
	cout<<"The smallest element of the array: "<<smallestElementArray<<"\n";


	system("pause");
	return 0;
}

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