jasminsanchez jasminsanchez
  • 16-11-2017
  • Computers and Technology
contestada

Write a program that prints the number 1 through 10 using a while loop

Respuesta :

Zepdrix
Zepdrix Zepdrix
  • 17-11-2017
Which programming language are you working in?

Here is how you could achieve this in Python:

establish a counter, starting at 1.
While your counter is 10 or less, do two things:
print the counter,
and increase the counter by 1.

code:
counter = 1

while counter <= 10:
print(counter)
counter = counter + 1

Those last two lines should be indented.
Answer Link

Otras preguntas

For the function y=f(x), what is the ordered pair for the point on the graph when x= b-2?A) (b-2, f(b-2))B) (x, f(b))C) (x, b-2)D) (b - 2, f(b))
How do I solve this operation
Determine the principal P that must be invested at rate r = 7%, compounded monthly, so that $500,000 will be available for retirement in t = 19 years. (Round yo
How do I solve this operation
A and B share the cost in a ratio of 3:2. the cost is £85; How much does A pay?
What word describes the moving of animals from one part of the world to another?
If the product of a number and -8 is subtracted from the number, the result is 7 more than the number. find the number. Use x for the number. x-(-8x)=
If the product of a number and -8 is subtracted from the number, the result is 7 more than the number. find the number. Use x for the number. x-(-8x)=
steps taken to conserve the flora and fauna of the country ?
How do I say.. I'm Watching television in German?