Ask Question

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

+4
Answers (1)
  1. 27 July, 13:08
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a for loop that displays the following set of numbers: 0,10,20,30,40,50 ... 1000 ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers