C++ Program to find the Largest element in the array

      No Comments on C++ Program to find the Largest element in the array
#include<iostream.h>
#include<conio.h>
void  main()
{
clrscr();
int a[1000],x,i,z=0;
cout<<"Enter size of array:- ";
cin>>x;
cout<<"Enter Elements in array:- ";
for(i=0;i<x;i++)
 {
  cin>>a[i];
 }
for(i=0;i<x;i++)
 {
  if(a[i]>z)
   {
     z=a[i];
   }
 }
cout<<"Largest element in array is:- "<<z;
getch();
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *