Q#3*
Fill in the blanks in the following algorithm to print natural
numbers up to a given number.
step1: start
step2: print "How many natural numbers do you want?
step3: read Count
step4: Counter = 1
step5: print Counter
step6: Counter =
step7; if
then go to step
step8: stop
Write Step6 and Step7 of this algorithm bellow.
Answers
Answered by
7
Answer:
Explanation:
thank you ; mark as brainlist
Attachments:
Answered by
1
The algorithm prints natural numbers up to a given number is :
step1: start
step2: print "How many natural numbers do you want?
step3: read Count
step4: Counter = 1
step5: print Counter
step6: Counter = Counter + 1
step7: if Counter <= Count
then go to step 5
step8: stop
- Start the algorithm by initiating the process.
- Ask the user for input on how many natural numbers they want to be printed.
- Read the user input and store it in a variable called "Count".
- Set a counter variable called "Counter" to 1.
- Print the value of "Counter".
- Increment the value of "Counter" by 1.
- Check if the value of "Counter" is less than or equal to "Count".
- If the condition in Step 7 is true, repeat Step 5.
- If the condition in Step 7 is false, stop the algorithm.
#SPJ2
Similar questions