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/ Explanation:

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 

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad