Asked by
AL MaMun (4 Golds)
Friday, 31 Jul 2020, 04:32 PM
at (Education
Tutorials)
|
|
|
|
A C program to find Highest and Lowest number in a number series #include<stdio.h> int main() { int i, j, n, a[100], highest, lowest, temp; printf("How many numbers: "); scanf("%d", &n); printf("Enter %d numbers now: \n", n); for(i=0; i<n; i++) { scanf("%d", &a[i]); } ///Insertion sorting for(j=1; j<n; j++) { for(i=0; i<n; i++) { temp=a[i]; if(a[i]>a[j]) { a[i]=a[j]; a[j]=temp; } } } printf("\nHighest Number = %d\n", a[n-1]); printf("Lowest Number = %d", a[0]); return 0; } |