Largest number among the three input numbers
Aim:
Implement a
program to find the largest number among the three input numbers
Algorithm
1. Start
2. Read
variables num1,num2 and num3
3. If
num1>num2 and If num1>num3
4. Display
num1 is the largest number.
5. Else
Display num3 is the largest number.
6. Else
If num2>num3
7. Display
num2 is the largest number.
8. Else
num3 is largest number
9. Stop
Program:
# take three numbers
from user
num1 =
float(input("Enter first number: "))
num2 =
float(input("Enter second number: "))
num3 =
float(input("Enter third number: "))
if (num1 > num2) and
(num1 > num3):
largest = num1
elif (num2 > num1)
and (num2 > num3):
largest = num2
else:
largest = num3
print("The largest
number is",largest)
Output :
Enter first number: 10
Enter second number: 12
Enter third number: 14
The largest number is
14.0
0 Comments:
Post a Comment