You are on page 1of 1

Array Example

============================================
#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
void main()
{
clrscr();
int a[10];
long int sum=0;
for (int i=0;i<10;i++)
{
a[i]=1+rand()%100;
cout<<a[i]<<" ";
sum=sum+a[i];
}

for (long int j=sum;j>=1;j--)


{
for (int k=0;k<10;k++)

{
if (a[k]==j)
{
cout<<"\n\nLocation: "<<k+1;
cout<<"\n\nLargest No: "<<a[k];
getch();
exit(0);
}
}
}

getch();

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006