Ask Question
7 July, 13:21

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

+2
Answers (1)
  1. 7 July, 16:55
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers