How to resolve the algorithm Loops/Break step by step in the NS-HUBASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Loops/Break step by step in the NS-HUBASIC programming language
Table of Contents
Problem Statement
Show a loop which prints random numbers (each number newly generated each loop) from 0 to 19 (inclusive).
If a number is 10, stop the loop after printing it, and do not generate any further numbers.
Otherwise, generate and print a second random number before restarting the loop.
If the number 10 is never generated as the first number in a loop, loop forever.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Loops/Break step by step in the NS-HUBASIC programming language
Source code in the ns-hubasic programming language
10 I=RND(20)
20 PRINT I
30 IF I=10 THEN STOP
40 PRINT RND(20)
50 GOTO 10
You may also check:How to resolve the algorithm FizzBuzz step by step in the make programming language
You may also check:How to resolve the algorithm File input/output step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Poker hand analyser step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Best shuffle step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Loops/Do-while step by step in the REXX programming language