Showing posts with label Largest of Three Numbers Using Nested IF Else In Python. Show all posts
Showing posts with label Largest of Three Numbers Using Nested IF Else In Python. Show all posts

Friday, March 15, 2019

Largest of Three Numbers Using Nested IF Else In Python


Design a program that will ask the user to give three numbers using nested if statement. The program will check which of the three number has the highest numerical value and display the result on the screen.


Program Listing


# Rollyn M. Moises and Jake R. Pomperada
# bigger.py
# February 7, 2019  Thursday
# Bacolod City, Negros Occidental
print();
print("\tLargest of Three Numbers Using Nested IF Else ");
print();
a = int(input("\tEnter first number: "))
b = int(input("\tEnter second number: "))
c = int(input("\tEnter third number: "))
if (a > 0 and b > 0 and c > 0 ) :
 if (a >= b) and (a >= c):
   largest = a;
elif (b >= a) and (b >= c):
   largest = b;
else:
   largest = b;
print();
print("\tThe largest number between {0},{1} and {2} is {3}.".format(a,b,c,largest));
print();

print("\tEND OF PROGRAM");