How to resolve the algorithm Phrase reversals step by step in the Yabasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Phrase reversals step by step in the Yabasic programming language

Table of Contents

Problem Statement

Given a string of space separated words containing the following phrase:

Show your output here.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Phrase reversals step by step in the Yabasic programming language

Source code in the yabasic programming language

phrase$ = "Rosetta Code Phrase Reversal"

dim word$(1)

n = token(phrase$, word$())

print phrase$

for i = n to 1 step -1
    print reverse$(word$(i)), " ";
next

print

for i = n to 1 step -1
    print word$(i), " ";
next

print

for i = 1 to n
    print reverse$(word$(i)), " ";
next

print

sub reverse$(w$)
    local i, rw$
    
    for i = len(w$) to 1 step -1
        rw$ = rw$ + mid$(w$, i, 1)
    next
    
    return rw$
end sub

  

You may also check:How to resolve the algorithm Determine if a string is numeric step by step in the Java programming language
You may also check:How to resolve the algorithm Angle difference between two bearings step by step in the Python programming language
You may also check:How to resolve the algorithm MD4 step by step in the Lasso programming language
You may also check:How to resolve the algorithm Arrays step by step in the C# programming language
You may also check:How to resolve the algorithm Here document step by step in the C++ programming language