Write a C++ program to find the largest element of a given array of integers.

Write a C++ program to find the largest element of a given array of integers. 



#include<iostream>
using namespace std;
int main()
{
int i,n,arr[5];
cout<<"Enter Total Numbers of Elements(1 to 5): ";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"Enter Number "<<i+1 <<": ";
cin>>arr[i];
}
for(i=1;i<n;i++)
{
if(arr[0]<arr[i])
arr[0]=arr[i];
}
cout<<"Largest Number Is :"<<arr[0];
return 0;
}

Write a C++ program to find the largest element of a given array of integers.