Input 10 numbers and print the smallest using while loop in Python
while Loop - Question 3
In this question, we will see how to input 10 numbers and print the smallest among them in Python programming using while loop. To know more about while loop click on the while loop lesson.
Q3) Write a program in Python to input 10 numbers and print the smallest among them using while loop.
i=1 print('Enter 10 numbers') while i<=10: n=int(input()) if i==1: sm=n # store the first number elif n<sm: # compare the previous stored number with the latest entered number sm=n i=i+1 print('Smallest Number = %d' %(sm))
Enter 10 numbers 12 6 48 95 3 11 27 36 54 89 Smallest Number = 3