How to resolve the algorithm Greatest element of a list step by step in the PowerBASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Greatest element of a list step by step in the PowerBASIC programming language

Table of Contents

Problem Statement

Create a function that returns the maximum value in a provided set of values, where the number of values may not be known until run-time.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Greatest element of a list step by step in the PowerBASIC programming language

Source code in the powerbasic programming language

FUNCTION PBMAIN()
    DIM x AS LONG, y AS LONG, z AS LONG
    RANDOMIZE TIMER

    FOR x = 1 TO 10
        y = INT(RND * 10000)
        z = MAX(y, z)
    NEXT

    ? STR$(z) & " was the highest value"
END FUNCTION

  

You may also check:How to resolve the algorithm Call a function step by step in the Racket programming language
You may also check:How to resolve the algorithm Bulls and cows step by step in the jq programming language
You may also check:How to resolve the algorithm Multifactorial step by step in the МК-61/52 programming language
You may also check:How to resolve the algorithm Bell numbers step by step in the Haskell programming language
You may also check:How to resolve the algorithm Compare a list of strings step by step in the Red programming language