How to resolve the algorithm Sum of squares step by step in the Run BASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sum of squares step by step in the Run BASIC programming language

Table of Contents

Problem Statement

Write a program to find the sum of squares of a numeric vector. The program should work on a zero-length vector (with an answer of   0).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sum of squares step by step in the Run BASIC programming language

Source code in the run programming language

list$ = "1,2,3,4,5"
print sumOfSquares(list$)

FUNCTION sumOfSquares(sos$)
  while word$(sos$,i+1,",") <> ""
    i = i + 1
    sumOfSquares = sumOfSquares + val(word$(sos$,i,","))^2
  wend
END FUNCTION

  

You may also check:How to resolve the algorithm Semiprime step by step in the Raku programming language
You may also check:How to resolve the algorithm Increment a numerical string step by step in the Eero programming language
You may also check:How to resolve the algorithm MD5 step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Parsing/RPN to infix conversion step by step in the J programming language
You may also check:How to resolve the algorithm Word wheel step by step in the Delphi programming language