An array is a data structure used to store blocks of information in a contiguous memory allocation. The data can be whole character strings, character class objects, etc. In this article, I will introduce you to a C ++ program to find the maximum and minimum element in an array.
C++ Program to Find the Maximum and Minimum Element in an Array:
Before heading to our program let’s see how to declare an array in the C++ Programming language:
Now let’s see how to write a C++ program to find the max and min element in an array. To do so we need to follow two simple steps.
The first step is to take the input n and declaring an Integer Array of size n, and the second step is iterating the Array and calculating the max and min elements.
Now let’s see how to implement it by using the C++ programming language:
5
78 90 100 34 56
Maximum Element :100 Minimum Element :34
I hope you liked this article on how to find the maximum and minimum element in an array by using the C++ programming language. Feel free to ask your valuable questions below.