
Algorithm Looping and Number Generation Examples
Learn about algorithm looping, iterations, and how to generate numbers using algorithms from 1 to 100 and in reverse order. The provided visual aids help illustrate the step-by-step process.
Uploaded on | 0 Views
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
AlgorithmLooping A loop is a sequence that gets executed several times. A complete execution of a sequence is called an iteration of the loop.
Step 1: Start Step 2: no=1 Step 3: Print no Step 4: no=no+1 Step 5: Print no Step 6: no=no+1 Step 7: Print no Step 8: no=no+1 Step 9: Print no Step 10: no=no+1 Step 11: Print no Step 12: no=no+1 Step 13: Print no Step 14: no=no+1 Step 15: Print no Step 16: no=no+1 Step 17: Print no Step 18: no=no+1 Step 19: Print no Step 20: no=no+1 Step 21: Print no Step 22:End Write an algorithm to print numbers from 1 to 10 Step 1: Start Step 2: no1=1 Step 3: no2=2 Step 4: no3=3 Step 5: no4=4 Step 6: no5=5 Step 7: no6=6 Step 8: no7=7 Step 9: no8=8 Step 10: no9=9 Step 11: no10=10 Step 12: Print no1,no2,no3,no4,no5,no6,no7,no8,no9,no10 Step 13: End Step 1: Start Step 2: no=1 Step 3: Test if no<=10 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no+1 Step 6: goto 3 Step 7: End
Algorithm to find nos. from 1 to 100 Algorithm to find nos. from 1 to 10 Algorithm to find nos. from 1 to 50 Step 1: Start Step 2: no=1 Step 3: Test if no<=100 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no+1 Step 6: goto 3 Step 7: End Step 1: Start Step 2: no=1 Step 3: Test if no<=10 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no+1 Step 6: goto 3 Step 7: End Step 1: Start Step 2: no=1 Step 3: Test if no<=50 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no+1 Step 6: goto 3 Step 7: End Algorithm to find nos. from 100 to 1 Algorithm to find nos. from 10 to 1 Algorithm to find nos. from 50 to 1 Step 1: Start Step 2: no=100 Step 3: Test if no>=1 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no-1 Step 6: goto 3 Step 7: End Step 1: Start Step 2: no=10 Step 3: Test if no>=1 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no-1 Step 6: goto 3 Step 7: End Step 1: Start Step 2: no=50 Step 3: Test if no>=1 Yes goto 4 No goto 7 Step 4: Print no Step 5: no=no-1 Step 6: goto 3 Step 7: End