Q1. Write a Python program to input three number and print minimum of them.
(3)
3
Answers
- Write a Python program to input 3 numbers and print the smallest number among them.
a = int(input('Enter The First Number : '))
b = int(input('Enter The Second Number : '))
c = int(input('Enter The Third Number : '))
d= 0
if (a < b) and (a < c):
d=a
elif (b < a) and (b < c):
d=b
else:
d=c
print("The smallest of the 3 numbers is : ", d)
- Write a program in python to find the second largest number among 3 numbers.
- Write a program in python to find the largest number among 3 numbers.
Answer:
number1 = int(input('Enter First number : '))
number2 = int(input('Enter Second number : '))
number3 = int(input('Enter Third number : '))
def largest(num1, num2, num3):
if (num1 > num2) and (num1 > num3): largest_num = num1 elif (num2 > num1) and (num2 > num3):
largest_num = num2 else: largest_num = num3 print("The largest of the 3 numbers is : ", largest_num)
def smallest(num1, num2, num3):
if (num1 < num2) and (num1 < num3): smallest_num = num1 elif (num2 < num1) and (num2 < num3):
smallest_num = num2
else:
smallest_num = num3 print("The smallest of the 3 numbers is : ", smallest_num)
largest(number1, number2, number3)
smallest(number1, number2, number3)
Explanation:
- hope it helps you..
- abhi230204 ⚘❤⚘