prev | for loop 122.Interchange Biggest & smallest of 10 nos - integer array(03.08.2010) /* Program# 122 date : 14-01-2009 Interchange Biggest & smallest of 10 nos - integer array */ #include <stdio.h> main(){ int i,a[10],bpos,spos,tmp; spos=0; bpos=0; for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<10;i++){ bpos=(a[i]>a[bpos])?i:bpos; spos=(a[i] } /* Interchange position */ tmp=a[bpos]; a[bpos]=a[spos]; a[spos]=tmp; for(i=0;i<10;i++) printf("\n%d",a[i]); } |
next |