# Paper Pencil Method of Multiplication

Discussion in 'C++' started by anniefaty, Sep 5, 2010.

1. ### anniefatyNew Member

Joined:
Sep 5, 2010
Messages:
1
0
Trophy Points:
0
can some one get me started on this c++ assignment.

This lab is mainly an output-formatting exercise. It does require that you know how to develop the product of two integers, without using a calculator.

Problem statement
Write a program that multiplies two 4-digit positive integers and prints their product in the format below. Your program should ask the user to type the two numbers, then read them in. As an example, the product of 4560 and 4334 should produce the following output.
Notice that the alignment should be the same as youâ€™d get if you multiplied the numbers using a pencil and paper.

4560
x 4334
---------
18240
13680
13680
18240
---------
19753920

You have to pull out the digits of the top number. 1000th digit is â€˜4â€™. So youâ€™d then multiply â€˜4â€™ time 4334. There are different ways of solving this.

2. ### go4expertModerator

Joined:
Aug 3, 2004
Messages:
306
9
Trophy Points:
0
You have to split the digit but getting the each digit.

You have to divide by 10 and extract the remainder and then multiply it with the original number.

Repeat the same for all digit and then display them.