\* C Program to to find position of second smallest element in array *\
# include < stdio.h >
int main( )
{
int a[20], b[20], n, sml=0, pos, i, j, temp ;
printf(" Enter the Numbers of terms: ") ;
scanf("%d ", & n) ;
printf("\n Enter the terms : \n") ;
for ( i = 1 ; i < = n ; i++ )
{
scanf("%d ", & a[i]) ;
b[i] = a[i] ;
}
for ( i = 1 ; i < = n ; i++ )
{
for ( j = 1 ; j < = n ; j++ )
{
if ( a[i] <= a[j] )
{
temp = a[i] ;
a[i] = a[j] ;
a[j] = temp ;
}
}
}
printf("\n The Array Elements are: \n") ;
for ( i = 1 ; i < = n ; i++ )
printf(" %d \t", b[i]) ;
sml = a[2] ;
for ( i = 1 ; i < = n ; i++ )
{
if ( sml == b[i] )
{
pos = i ;
}
}
printf("\n Position of second smallest Element is: %d", pos) ;
printf("\n Second Smallest Number is : %d", sml) ;
return ( 0 ) ;
}