Largest element of array

 #include <iostream>

using namespace std;


int main() {

    int n,max=0;

    cin>>n;

    int arr[100];

    for(int i=0;i<n;i++){

        cin>>arr[i];

    }

    for(int i=0;i<n;i++){

        if(max<arr[i]){

            max=arr[i];

        }

       // cout<<max;

        

    }

   

    cout << max;

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings