## Invitation to Computer Science 8th Edition

Published by Cengage Learning

# Chapter 1 - Exercises - Page 40: 12

#### Answer

\begin{equation} \begin{array}{l}{\text { Step } 1 \text { Set product to } 0} \\ {\text { Step } 2 \text { Set value of Count to } 0} \\ {\text { Step } 3 \text { Repeat steps } 4 \text { through } 5 \text { until Count equals b }} \\ {\text { Step } 4 \text { Add } a \text { to the value of product }} \\ {\text { Step } 5 \text { Add } 1 \text { to the value of Count }} \\ {\text { Step } 6 \text { Print out the result product }}\end{array} \end{equation}

#### Work Step by Step

An algorithm for multiplying two positive numbers $a$ and $b :$ \begin{equation} \begin{array}{l}{\text { Step } 1 \text { Set product to } 0} \\ {\text { Step } 2 \text { Set value of Count to } 0} \\ {\text { Step } 3 \text { Repeat steps } 4 \text { through } 5 \text { until Count equals b }} \\ {\text { Step } 4 \text { Add } a \text { to the value of product }} \\ {\text { Step } 5 \text { Add } 1 \text { to the value of Count }} \\ {\text { Step } 6 \text { Print out the result product }}\end{array} \end{equation}

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.