prev


for loop

124. Second Biggest & Second Smallest 10 nos - integer array(03.08.2010)

/*
Program# 124
date : 14-01-2009
Second Biggest & Second Smallest 10 nos - integer array
*/

#include <stdio.h>
main(){
int i,big,small,a[10];
int sbig,small2;
small=big=0;
for(i=0;i<10;i++)
scanf("%d",&a[i]);

for(i=0;i<10;i++){
big=(a[i]>big)?a[i]:big;
small=(a[i] }

sbig=a[0];
small2=a[0];

for(i=0;i<10;i++){
sbig=((a[i]!=big)&&(a[i]>sbig))?a[i]:sbig;
small2=((a[i]!=small)&&(a[i] }

printf("\n Biggest & smallest : %d \t %d ",big,small);
printf("\n Second Biggest & smallest : %d \t %d ",sbig,small2);
}



next
blog comments powered by Disqus