This program accepts ten numbers from the user and display the lowest one,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include "conio.h" #include "stdio.h" void main() { int num[10],low,i=0,j=1; printf("\nPlease provide 10 numbers to find lowest one "); for(;i<10;i++,j++) { printf("\nEnter number %d : ",j); scanf("%d",&num[i]); } low=num[0]; i=0,j=1; //finding greatest number for(;inum[i+1]) { low=num[i+1]; } } //displaying lowest value printf("\nThe lowest number is : %d",low); getch(); } |
Output:
Please provide 10 numbers to find lowest one Enter number 1 : 45 Enter number 2 : 63 Enter number 3 : 85 Enter number 4 : 77 Enter number 5 : 21 Enter number 6 : 68 Enter number 7 : 79 Enter number 8 : 82 Enter number 9 : 101 Enter number 10 : 22 The lowest number is : 21 |