#include<stdio.h>
#include<conio.h>
int main()
{
int DATA[10] = { 70 , 30 , 25 , 80 , 60 , 50 , 30 , 75 , 25 , 60 } ;
int K , M , N , LOC1 = 0 , LOC2 = 1 ; //M=Maximum and N=2nd maximum
M = DATA[0] ;
N = DATA[1] ;
if( LOC1 < LOC2 )
{
LOC1 = 1 ;
LOC2 = 0 ;
}
for( K = 3 ; K <= 10 ; K++ )
{
if( M < DATA[K] )
{
LOC2 = LOC1 ;
M = DATA[K] ;
LOC1 = K ;
}
else if (N < DATA[K] )
{
N = DATA[K] ;
LOC2 = K ;
}
}
printf( “Largest Element: %d\nLOC: %d\n” , M , LOC1 ) ;
printf( “Second Largest Element: %d\nLOC: %d” , N , LOC2 ) ;
getch() ;
return 0 ;
}