algorithm to print series of 1 to n using do while loop - data structures and algorithms
September 24, 2022

Algorithm to print series 1 to N using do while loop

In this tutorial, we are going to write an algorithm to print the series 1 to N using the do-while loop. using this algorithm we can write a program to print the series 1 to N using the do-while loop in most programming languages like java, python, c++, and c programming.


Algorithm to print the series 1 to N using do while loop.

1. Read N.
2. Set I:=1.
3. Write I.
4. Set I:=I + 1.
5. if I <= N, then: goto step3.
6. Exit.

In the above algorithm, we first read an integer variable N and then set the default value of another variable I to 1. after that we will write the value of I to the output screen and then set the value of I to I + 1 and then we will check if the value of I is less than or equal to N then we will go to step 3 again. these two steps will execute till the value of I <= N after that we will exit from the program.

Leave a Reply

Your email address will not be published. Required fields are marked *