67.4k views
1 vote
When you use a while loop to compute the product of several values, you should initialize the variables holding the product to ______ .

a. 0

b. 1

c. NULL

d. there is no need to initalize it

User Thandiwe
by
5.2k points

1 Answer

3 votes

Answer:

b.1

Step-by-step explanation:

When we are using while loop to compute the product of several values we need to initialize the value holding the product to 1 because when we multiply something with 1 it will give the same number.

If we initialize it with 0 the product will come out to be 0 because anything multiplied by 0 is 0.

we cannot initialize it with NULL because it is not a pointer.

We need to initialize the number since it contains garbage values so it will give product with that value.

User Kavin Raju S
by
5.0k points