30.7k views
1 vote
Write an algorithm to generate the first 10 natural number.​

1 Answer

0 votes

Answer:

step1: Start

step2: let x = 1

step3: while x<=10

step4: print x

step5: x = x + 1

step6: stop

Step-by-step explanation:

On step 2, x is assigned a value of 1, since 1 is the first natural number.

On step 3, i used a while loop which will repeat for 10 times since we are to generate the first 10 natural number. On step 4 the value of x is displayed while the condition on step 3 is True. Step 5 increase the value of x by 1 and step 3 is checked again to see if the condition is True. While the condition on step 3 remains True, step 4 and 5 is repeated, while step 6 is executed when the condition on step 3 becomes False.

User Clutch
by
4.7k points