38.9k views
4 votes
Using a for loop in C++

In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop.
Write a for loop that uses the loop control variable to take on the values 0 through 10.
In the body of the loop, multiply the value of the loop control variable by 2 and by 10.
Execute the program by clicking the Run button at the bottom of the screen. Is the output the same?

1 Answer

2 votes

Answer:

I hope this helps you out. if you like my answer please give me a crown

Step-by-step explanation:

The program is an illustration of loops.

Loops are used to perform repetitive and iterative operations.

The program in Python where comments are used to explain each line is as follows:

#This prints the output header

print("Number\tMultiplied by 2\t Multiplied by 10")

#This iterates from 0 to 10

for i in range(0,11):

#This prints each number, it's double and its product by 10

print(str(i) + "\t\t" + str(i * 2) + "\t\t" + str(i*10))

User Eradicatore
by
7.9k points

No related questions found