A mathematician who is working with extremely large integers them using a doubly linked list. For example, the number 7328 will be represented as the doubly linked list with four nodes.
7 3 2 8
The predecessor of the first node and the successor of the last node are null.
Write a program that reads in two numbers (assume they are integers for testing), converts them to the above representation, prints them out with each digit separated by commas and checks whether the two numbers are equal or not. The equality check should work on the representation and not on the integers.
Here are sample outputs.
Input: Give the first number: 34563 Give the second number: 34562 Output: First number: 3,4,5,6,3 Second number: 3,4,5,6,2 Unequal
Have something to say? Log in to comment on this post.