//Program to find the Largest element in array using C++.
#include<iostream.h>
#include<conio.h>
void main()
{
int i, k, loc, max, data[50], n;
clrscr();
cout<<endl<<"Enter the number of elements in the array:";
cin>>n;
cout<<endl<<"Enter the value of "<<n<<" elements:";
for(i=0; i<n; i++)
{
cin>>data[i];
}
loc=0;
max=data[0];
for(k=0; k<n; k++)
{
if(max<data[k])
{
loc=k;
max=data[k];
}
}
cout<<endl<<"Largest element is "<<max<<" and its location is "<<loc;
getch();
}