How to resolve the algorithm Loops/Break step by step in the uBasic/4tH programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Loops/Break step by step in the uBasic/4tH 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 uBasic/4tH programming language
Source code in the ubasic/4th programming language
Do
n = RND(20)
Print n
Until n = 10
Print RND(20)
Loop
You may also check:How to resolve the algorithm Increment a numerical string step by step in the sed programming language
You may also check:How to resolve the algorithm Find the last Sunday of each month step by step in the RPL programming language
You may also check:How to resolve the algorithm Price fraction step by step in the K programming language
You may also check:How to resolve the algorithm Determine if a string is numeric step by step in the R programming language
You may also check:How to resolve the algorithm Increment a numerical string step by step in the Toka programming language