Write a program to read two integer values and print true if both the numbers end with the same digit, otherwise print false.
Example: If 698 and 768 are given, program should print true as they both end with 8.
For example, if the user gives the input as 25 53:
Enter two integer values : 25 53
then the program should print the result as:
false
Answers
Answered by
6
Answer:
The following códe is written in python
___
a,b=(int)(input("Enter a number:")),(int)(input("Enter a number:"))
isSame= "true" if a%10==b%10 else "false"
print("No. ends with same digit?",isSame)
Note:-
a,b=(int)(input("Enter a number:")),(int)(input("Enter a number:"))
- You can also ask input in separate lines. The above is combination of two lines in order to shorten the códe
isSame= "true" if a%10==b%10 else "false"
- you can also write this as...
if(a%10==b%10):
isSame="true"
else:
isSame="false"
Required Output Attached.
Attachments:
Answered by
0
Attachments:
Similar questions