Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Repetation and Loop statements (while or if statement) 1. Write a program that r

ID: 3641337 • Letter: R

Question

Repetation and Loop statements (while or if statement)

1. Write a program that reads a collection of positive and negative num-
bers and multiplies only the positive integers. Loop exit should occur
when three consecutive negative values are read.

Explanation / Answer

For future questions, please include the programming language you need help in. Since you have not supplied one, I will write this for you in C++. Since you did not specify if the numbers will contain decimals or not I have made it include decimals #include #include using namespace std; int main () { double total = 0; double input = 0; int counter = 0; whie(true) { cout > input; if(input >= 0) { total = total * total; counter = 0; } else if(input < 0) { if(counter == 3) { break; } counter++; } } system("PAUSE"); return EXIT_SUCCESS; } Hope this helps! Did not test code since I do not have a C++ compiler on me right now.