marrioncu17
marrioncu17 marrioncu17
  • 26-02-2018
  • Computers and Technology
contestada

write a for loop that displays the following set of numbers: 0,10,20,30,40,50....1000

Respuesta :

Rodiak
Rodiak Rodiak
  • 07-03-2018
C# program code:

int i = 0
while (i<=1000)
{
console.Writeline("{0}",i);
i = i + 10;
}

Explanation:
First we set variable to initial value. In this example it is 0. Then we enter into while loop. This type of loop executes the code until the condition is fulfilled. In our case while loop checks if i <=1000. It is and then it writes it on the screen. Next step is to increase it by 10. Then it does the same code again.
Last number that will be printed is 1000. After that it will increase i to 1010 and it will exit the loop.
Answer Link

Otras preguntas

Susan charges $8 per hour walking her neighbor’s dog. She charges $12 per hour babysitting. Part A: Define the variables. Part B: Write an expression to represe
A car is going 43m/s and travels 14 m, how long did it take?
Are there striations in the skeletal muscle tissue
Give a counterexample for the statement all square roots are irrational numbers
if abus travelling at 20m/s is subject to steady decceleration of 5m/s².how long will it take yo come to rest.​
What is 3x times 10 divided by 1
what is the main goal of the Constitution as stated in the preamble​
Solve the equation for x. 3/4(x + 21) = 10 1/2
Observa la siguiente imagen: Responde: ¿quienes son? ______________________ ¿que sentimientos te inspiran? _________________ Necesitó ayuda urgentee
A weightlifter can lift 495 lbs. How many kg is that? Please provide a step-by-step procedure.