How to resolve the algorithm Sum of squares step by step in the 360 Assembly programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sum of squares step by step in the 360 Assembly 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 360 Assembly programming language
Source code in the 360 programming language
* Sum of squares 27/08/2015
SUMOFSQR CSECT
USING SUMOFSQR,R12
LR R12,R15
LA R7,A a(1)
SR R6,R6 sum=0
LA R3,1 i=1
LOOPI CH R3,N do i=1 to hbound(a)
BH ELOOPI
L R5,0(R7) a(i)
M R4,0(R7) a(i)*a(i)
AR R6,R5 sum=sum+a(i)**2
LA R7,4(R7) next a
LA R3,1(R3) i=i+1
B LOOPI end i
ELOOPI XDECO R6,PG+23 edit sum
XPRNT PG,80
XR R15,R15
BR R14
A DC F'1',F'2',F'3',F'4',F'5',F'6',F'7',F'8',F'9',F'10'
PG DC CL80'The sum of squares is: '
N DC AL2((PG-A)/4)
YREGS
END SUMOFSQR
You may also check:How to resolve the algorithm Dot product step by step in the EchoLisp programming language
You may also check:How to resolve the algorithm Function composition step by step in the SuperCollider programming language
You may also check:How to resolve the algorithm Parsing/Shunting-yard algorithm step by step in the VBA programming language
You may also check:How to resolve the algorithm Heronian triangles step by step in the AppleScript programming language
You may also check:How to resolve the algorithm Exponentiation operator step by step in the Liberty BASIC programming language