Q. Write a program to take an integer "a" as an input and check whether it ends with 4 or 8. if its ends with 4, print "ends with 4", if it end with 8, print "ends with 8", otherwise print "ends with neither".
You can understand by Watching video :-
Answer :-
a = int(input("Enter a number = ")) if a % 10 == 4 : print(a,"end with 4") elif a% 10 == 8 : print(a,"end with 8 ") else : print(a,"end with neither ")
Output :-
Enter a number = 8
8 end with 8
>>>
Enter a number = 54
54 end with 4
>>>
Enter a number = 54254
54254 end with 4
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )