------------------------------------------
/*Program to create user defind array list
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,i,j;
int num[100],large;
cout<<"\nEnter number of elements in list:";
cin>>n;
cout<<"\nEnter "<<n<<" Numbers:";
for(i=0;i<n;i++)
{
cin>>num[i];
}
cout<<"\nList elements :";
for(i=0;i<n;i++)
{
cout<<" "<<num[i];
}
cout<<"\nLargest element is :";
large=num[0];
for(i=0;i<n;i++)
{
if(num[i]>=large)
{
large=num[i];
}
}
cout<<large;
getch();
}
-----------------------------------------
No comments:
Post a Comment