Question: Suppose we declare the following variables: int count = 0; int iNumber = 1, previous = 1, product = 1; Write the while loop that


Suppose we declare the following variables:

int count = 0;

int iNumber = 1, previous = 1, product = 1;


Write the while loop that do the following if product is still less than 2022

-increase count by 1

-set previous equal to product

-lets the user enter a number for iNumber.

-multiply iNumber with product and the result is stored back to the variable product.


After the loop stop, display the output in the following format (for example)

At count = 3

Previous product = 782

Input number = 45

Product = 35190


2B

If product = 3000 instead of product = 1 at the beginning. How many times does the while loop iterate such that the product < 2022?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To achieve the described functionality with the provided variables and requirements here is a sample ... View full answer

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 Programming Questions!