Multiplication
InterviewTime limit1sMemory limit128 MB
Given two three-digit numbers, print the partial products from vertical multiplication and their total.
- Level
Easy1 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Given two three-digit natural numbers A and B, compute their product in the usual vertical-multiplication order.
First multiply A by the ones digit of B, then by the tens digit of B, then by the hundreds digit of B. Finally, compute the full product A × B.
Input
The first line contains the three-digit natural number A.
The second line contains the three-digit natural number B.
Output
On the first line, print A multiplied by the ones digit of B.
On the second line, print A multiplied by the tens digit of B.
On the third line, print A multiplied by the hundreds digit of B.
On the fourth line, print A × B.