Question: Solve the following cryptarithmetic problem using Prolog : C R O S S + R O A D S = D A N G E
Solve the following cryptarithmetic problem using Prolog:
C R O S S + R O A D S = D A N G E R Each of the 10 different letters stands for a different digit. The aim is to find a substitution of digits for the letters such that the above equality is arithmetically correct.
Your program should find the answer that DO NOT HAVE LEADING ZEROS.
It should be possible to query your solution in this manner: ?- crypto(C,R,O,S,A,D,N,G,E).
Your solution should then produce the combination of the digits that satisfy the multiplication problem above ( note that there is only one solution). Don't get confused between the letter "O" and the number "0" (zero).
Make sure you never let C=R, or R=O, etc... distinct letters have to stand for distinct digits. It may take a little bit of time. Use generate-and-test!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
