Given an array A[] of size n. The task is to find the largest element in it.
int largest(int arr[], int n) {
int max = arr[0];
int i= 0;
// Traverse array elements from second and
// compare every element with current max
for(i = 1; i < n; i++){
if(arr[i] > max)
max = arr[i];
}
return max;
}