मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता १२

Using if..else..Elif statement writes a suitable program to display the largest of 3 numbers. - Computer Science

Advertisements
Advertisements

प्रश्न

Using if..else..Elif statement writes a suitable program to display the largest of 3 numbers.

थोडक्यात उत्तर

उत्तर

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

shaalaa.com
Control Structure
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Control Structures - Evaluation [पृष्ठ ८८]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 12 TN Board
पाठ 6 Control Structures
Evaluation | Q 3. | पृष्ठ ८८
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×