Programming Examples
Python program to input 3 numbers and check all are same or not
Write a Python program to input 3 Integer Number and check al numbers are same or not.
Solution 1:
n1=int(input("Enter Number 1 "))
n2=int(input("Enter Number 2 "))
n3=int(input("Enter Number 3 "))
if n1==n2==n3:
print("All 3 Numbers are same ")
else:
print("All 3 Numbers are not same")
Solution 2:
n1=int(input("Enter Number 1 "))
n2=int(input("Enter Number 2 "))
n3=int(input("Enter Number 3 "))
if n1==n2 and n2==n3:
print("All 3 Numbers are same ")
else:
print("All 3 Numbers are not same")
Output
Enter Number 1 5
Enter Number 2 7
Enter Number 3 4
All 3 Numbers are not same
>>>
========================
Enter Number 1 4
Enter Number 2 4
Enter Number 3 4
All 3 Numbers are same