Homework 8

 

1. Write a program that reads in a product computation of the following form:

 

N0 * N1 * N2 * N3 * Ö * Nn =

... and returns the product of the given ints, along with the number of terms in the product. Note that you donít know how many integer values the user will enter until they enter an equal sign (=).

An example run of your program might look like this (with the user input in red):

Please enter a product to be computed, followed by an = sign.
: 4 * 56 * 2 * 7 * 4 =
The product of the 5 numbers entered is 12544

Turn In a printout of the source code for your program and TWO screenshots, one showing your program running with the input from above, and the second screen shot showing your program running for the below input:

111 * 222 * 333 * 444 * 555 * 666 =

2. Can you explain the strange answer you get for the second input above (111 * 222 * Ö)??
NOTE: write your answer to this question as a comment at the very top of your program.Think about what might be happening, but donít spend a long time on this.

Turn in your source code, the two screen shots, and the answer to question 2 (as part of your source code, see instructions above).