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 

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz