Advertisements
Advertisements
Question
Using if..else..Elif statement writes a suitable program to display the largest of 3 numbers.
Solution
num 1 = int (input(“Enter first number : “))
num 2 = int (input(“Enter second number : “))
num 3 = int (input(“Enter third number : “))
if (num 1 > num 2) and (num 1 > num 3):
largest = num 1
elif (num 2 > num 1) and (num 2 > num 3):
largest = num 2
else:
largest = num3
print (“The largest number is”, largest)
Output:
Enter first number: 7
Enter second number: 5
Enter third number: 4
The largest number is 7
APPEARS IN
RELATED QUESTIONS
Which is the most comfortable loop?
Which amongst this is not a jump statement?
Which punctuation should be used in the blank?
if<condition>_
statement-block 1
else:
statement-block 2
List the control structures in Python.
Write a note on the range () in the loop?
Write the syntax of the while loop.
List the differences between break and continue statements.
Write a detail note on for loop?
Write a program to display all 3 digit odd numbers.
Write a program to display a multiplication table for a given number.