Horje
Find the biggest element in the array Code Example
Find the biggest element in the array

#include <iostream>
using namespace std;
int main()
{
    // input
    int n;
    cin >> n;
    int arr[10];
    int maxNum;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }

    // Algo
    maxNum = arr[0];
    for (int i = 0; i < n; i++)
    {
        if (maxNum < arr[i])
        {
            maxNum = arr[i];
        }
    }

    // output
    cout << maxNum;
    // for (int i = 0; i < n; i++)
    // {
    //     cout << arr[i] << " ";
    // }

    return 0;
}




Cpp

Related
how to say hello world in c++ Code Example how to say hello world in c++ Code Example
array Code Example array Code Example
how to know datatype of something in c++ Code Example how to know datatype of something in c++ Code Example
c++ how to add something at the start of a vector Code Example c++ how to add something at the start of a vector Code Example
C++ sum a vector of digits Code Example C++ sum a vector of digits Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7