76 245
Assignments Done
Successfully Done
In May 2019

Answer to Question #42006 in C++ for mohameed shab

Question #42006
wtita a progeam(starting from #include) that repeatedly collect possitive from the user stopping when the user entars a negative number to zero a output the prouduct of all positive entries .a sample run should apper on the text below
enter a number 3
enter a number 10
enter a number 2
enter a number -213
the prouduct of all your possitive number is 60
Expert's answer
#include <iostream>
using namespace std;
int main () {
int number;
int sum = 0;
while (true) {
cout << "enter a number ";
cin >> number;
if ( number < 0 ) {
sum += number;
cout << "the prouduct of all your possitive number is " << sum << endl;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions