Answers for "find min and max in array c++"

C++
1

find min and max in array c++

#include<iostream>

using namespace std;

public void getMax_MinValue(int arr[])
{
    int max, min;

    max = arr[0];
    min = arr[0];
    for (int i = 0; i < sizeof(arr); i++)
    {
        if (max < arr[i])
            max = arr[i];
        else if (min > arr[i])
            min = arr[i];
    }

    cout << "Largest element : " << max;
    cout << "Smallest element : " << min;
 
}
Posted by: Guest on October-10-2020
0

find min and max in array c++

12
323
343
we
we32
2323
Posted by: Guest on October-06-2021

Code answers related to "find min and max in array c++"

Browse Popular Code Answers by Language