1.

Write python programs for the following:a. To accept a number from the user and check if it ends with 4 or 8. If it ends with 4, print “Ends with 4”, if it ends with 8, print “Ends with 8”, otherwise print “Ends with neither”​

Answer»

QUESTION:-

Write a PYTHON program to accept a number from the user and CHECK whether it ends with 4 or 8.

Program:-

n=int(INPUT("ENTER a number: "))

n=n%10

if n==4:

print("Ends with 4.")

elif n==8:

print("Ends with 8.")

else

print("Neither ends with 4 or 8.")



Discussion

No Comment Found