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.
Also, Read
- Algorithm to Find Maximum of Two Numbers
- Algorithm to Find Maximum of Three Numbers
- Algorithm to Input percentage From user and Print grade
- Algorithm to Print the Series 1 to N using for loop
- Algorithm to Print the Series 1 to N using while loop
- Algorithm to Reverse a given Number
- Algorithm to Find Whether a Number is Prime or Not
- Algorithm for Linear Search in Array
- Algorithm to Calculate Factorial using Function