Find the highest and lowest number from the given set of 13 numbers.
Write a program in C to input 13 observation and then print Highest and Lowest.
#define N 13 void main( ) { printf("Enter %d integer values\n", N); for (i=0; i < N; i++) scanf("%d", &n[i]); for(i=0; i < N-1; i++) for (j=i+1; j < N; j++) if (n[i] > n[j]) { t = n[i]; n[i] = n[j]; n[j] = t; } printf("Highest number is %d", n[12]); printf("Lowest number is %d", n[0]); getch( ); } |
---|
0 comments:
Post a Comment