Answer to Question #41211 in C++ for Muhammad Lokman Darus

Question #41211
write a loop that lets the user to enter a number. The
number should be multiplied by 10, and the result stored
in the variable product. The loop should iterate as long as
product contains a value less than 100.
1
Expert's answer
2014-04-10T10:23:03-0400
#include <iostream>

int main() {
int product = 1, number;

std::cout << "Please enter a number" << std::endl;
std::cin >> number;

for ( ; ; ) {
if ( product > 100 ) {
break;
}
number *= 10;
product= number;
std::cout << product << std::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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS