Answer to Question #191180 in C++ for python

Question #191180

1. Write a C++ program that will find maximum number in an array?


1
Expert's answer
2021-05-16T12:22:03-0400
#include <iostream>
#include <string>


using namespace std;




int main(){
	
	int numbers[]={5,6,8,9,5,4,6,9,8,2};


	int max=numbers[0];
	 //find maximum number in an array
	for(int i=0;i<10;i++){
		if(max<numbers[i]){
			max=numbers[i];
		}
	}


	cout<<"Array numbers: ";
	for(int i=0;i<10;i++){
		cout<<numbers[i]<<" ";
	}


	cout<<"\nMaximum number in an array: "<<max<<"\n\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