Saved Bookmarks
| 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» stion:- 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.") |
|