subject

Given positive integer numInsects, write a while loop that prints that number doubled without reaching 100. Follow each number with a space. After the loop, print a newline. Ex: If numInsects = 8, print: 8 16 32 64

#include

using namespace std;

int main() {

int numInsects = 0;

numInsects = 8; // Must be >= 1

while (numInsects < 100) {

numInsects = numInsects * 2;

cout << numInsects << " ";

}

cout << endl;

return 0;

}

So my question is what am I doing wrong?

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:30, Molly666
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
image
Computers and Technology, 23.06.2019 12:30, umimgoingtofail
What is the difference between the internet and the world wide web?
Answers: 1
image
Computers and Technology, 23.06.2019 15:30, jasssp
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
image
Computers and Technology, 24.06.2019 13:00, giulissaf
Append and make table queries are called queries. select complex simple action i think action
Answers: 1
You know the right answer?
Given positive integer numInsects, write a while loop that prints that number doubled without reachi...

Questions in other subjects:

Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Geography, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01
Konu
Mathematics, 10.09.2020 09:01