Page 496 - ComputerScience_Class_11
P. 496
Syntax: Start
if condition1:
if condition2:
if condition 1?
block1
true false
else:
block2 if condition2? if condition3?
false
else: true
if condition3: Statement 1 false true Statement 4
block3
Statement 2 Statement 3
else:
block4
Stop
Program 5: Write a program to enter three numbers and find the smallest number.
Program 5.py
File Edit Format Run Options Window Help
a=int(input('Enter the first number: '))
b=int(input('Enter the second number: '))
c=int(input('Enter the third number: '))
if a<b:
if a<c:
print(a,'is the smallest number')
else:
print(c,'is the smallest number')
else:
if b<c:
print(b,'is the smallest number')
else:
print(c,'is the smallest number')
Output
Enter the first number: 10
Enter the second number: 20
Enter the third number: 30
10 is the smallest number
494 Touchpad Computer Science (Ver. 3.0)-XI

