Question: C Programming. Plesae help write or at least start this program. Patrick has a four function calculator; unfortunately his sister has decided to be a

C Programming. Plesae help write or at least start this program.

Patrick has a four function calculator; unfortunately his sister has decided to be a traditional evil sibling and has painted over the display. The calculator still functions, but of course you cant see the results. This calculator has a display constructed from seven-segment LEDs. The figure on the left below illustrates how the seven LED segments at each digit position are arranged.

This particular calculator only displays three digits of accuracy. There are three seven segment digits, and there are no decimal points since all math is performed using integers (with truncation where appropriate).

If the number on the display happens to be negative, there is a minus sign in front of the number. For a number such as -6, this is done by making the rightmost digit a 6 and using the middle segment of the next digit over as the minus sign. For a number such as -123, there is one additional segment to the left of the display. Thus, the number -112 lights up 10 segments, made up of 9 for the number, and one more for the minus sign. The display thus ranges from -999 to 999. There is no plus sign for positive numbers.

In order to prove that the calculator still operates, and justify scraping off the paint, the back cover is removed and an ammeter is attached to the display. An ammeter measures the current consumed by the device, and each segment of a digit consumes 5 milliamps. Thus, to display a number such as 798 the current consumption can be predicted as follows:

Digit 7 3 segments lit = 15 milliamps

Digit 9 6 segments lit = 30 milliamps

Digit 8 7 segments lit = 35 milliamps

Total = 80 milliamps

Of course, its apparent that the number 897 also consumes the same amount of current, as does 789 or, for that matter, -891.

The calculator allows you to enter numbers with an optional minus sign and up to three digits, and to either add, subtract, multiply, or divide the numbers. Patrick wishes to prove that the functionality of the calculator is intact, so he enters 949 and measures 80 milliamps. Then he pushes the subtract key. Next he enters 51 and measures 35 milliamps. After pressing the = key the result should be 898, measuring 100 milliamps. As a second example, he enters -5, then pushes the addition key. He then enters -4 and presses equal. The answer is -9; the measurements were 30 milliamps, 25 milliamps, and 35 milliamps respectively.

Patricks sister claims that this is a trick, so she presents him with the following problem: given the current consumption (in milliamps) of operand X, operand Y , and result Z, and given an unknown operation Op, determine the number of possible values for X Op Y = Z, assuming that possible solutions exist. If no such solutions exist, the answer is No solutions.

Note that in all cases, there are only three digits on the display. Although the input values of 80, 35, and 100 potentially could represent 12337 = 949 13, this is not possible because 12337 is too large for the three digit display to hold.

Example

An example is as shown above; for inputs 80, 35, and 100 one possibility is 925 117 = 808. Some input combinations may have no result. For the inputs 35, 10, and 10 the answer is No solutions. For any given input set, the program should either print No solutions. or it should print the number of solutions found.

Input

There will be multiple cases. Each input line contains values for X, Y , and Z. Each number is in milliamps according to the above description. A line containing a single zero follows the input data for the last case.

Output

For each case, display Case and the case number (1, 2, . . .), a colon and a blank, the number of solutions (or No if there are no solutions), and then the word solution or solutions (as appropriate) and a period. Your output should exactly follow this format, as is illustrated by the sample input and output shown below. Sample Input

30 10 10

35 10 10

15 20 30

30 65 65

0

Sample Output

Case 1: 1 solution.

Case 2: No solutions.

Case 3: 9 solutions.

Case 4: 819 solutions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!