Showing long method in C output instead of just answer

  • Thread starter chemic_23
  • Start date
  • Tags Tags
    C code Code
1 reply · 2K views · last reply
chemic_23
Messages
44
Reaction score
0
Handwritten sample output of long multiplication: Enter 3-digit no.: 132, Enter 2-digit no.: 43, then 132 times 43 worked out with partial products 396 and 528 and the total 5676.



my attempt is

C source code for a program that reads two integers with scanf, multiplies them into a variable named product, and prints the product with printf.


(this is c programming)

My output is really different. It gives the answer but not a detailed solution as the output above.

Pls help me I really don't know how to show the long method :frown:
 
chemic_23 said:
Handwritten sample output of long multiplication: 132 times 43, with partial products 396 and 528 and the final total 5676, under a program description.



my attempt is

C source code listing: a main function declares int x, y and product, prints prompts for two numbers, reads them with scanf, multiplies x*y and prints the product.


(this is c programming)

My output is really different. It gives the answer but not a detailed solution as the output above.

Pls help me I really don't know how to show the long method :frown:

There are quite a number of ways to proceed. It is probably easiest to enter numbers as integers, as you are doing. To be really safe, you can also check that each number is in the correct range of values before proceeding.

Step 1. How could you check that a number is a 2 digit or a 3 digit number?

In order to do the steps described, you need to break the second number into digits.

Step 2. If you know you have a two digit number in "y", can you figure out how to get the two digits?

That will do for a start...

Cheers -- sylas