Practical - 60 - Write a program in python to input two numbers and prints “SAME” if both the numbers are either even or both are odd otherwise prints “NOT SAME”.
Ans:
a=int(input("Enter first number: "))
b=int(input("Enter first number: "))
if(a%2==0 and b%2==0) or (a%2==1 and b%2==1):
print("SAME")
else:
print("NOT SAME")
Output:
Enter first number: 7
Enter first number: 8
NOT SAME
OR
Enter first number: 6
Enter first number: 8
SAME
OR
Enter first number: 5
Enter first number: 7
SAME
No comments:
Post a Comment