Computer Science, asked by praneelgirish70, 4 months ago

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”​

Answers

Answered by anindyaadhikari13
4

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.")

Answered by yesiamin6
5

Answer:

n=int(input("ent a number\n"))

c=n%10

if(c==4):

print("ENDS WITH 4\n")

elif(c==8):

print("END WITH 8\n")

else:

print("END WITH NEITHER\n")

Explanation:

Output is attached look at that

HOPE IT HELPS YOU

DO FOLLOW FOR MORE PROGRAMS

MARK AS BRAINLIEST

Attachments:
Similar questions