How to resolve the algorithm Factors of an integer step by step in the 360 Assembly programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Factors of an integer step by step in the 360 Assembly programming language
Table of Contents
Problem Statement
Compute the factors of a positive integer. These factors are the positive integers by which the number being factored can be divided to yield a positive integer result. (Though the concepts function correctly for zero and negative integers, the set of factors of zero has countably infinite members, and the factors of negative integers can be obtained from the factors of related positive numbers without difficulty; this task does not require handling of either of these cases). Note that every prime number has two factors: 1 and itself.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Factors of an integer step by step in the 360 Assembly programming language
Source code in the 360 programming language
* Factors of an integer - 07/10/2015
FACTOR CSECT
USING FACTOR,R15 set base register
LA R7,PG pgi=@pg
LA R6,1 i
L R3,N loop count
LOOP L R5,N n
LA R4,0
DR R4,R6 n/i
LTR R4,R4 if mod(n,i)=0
BNZ NEXT
XDECO R6,PG+120 edit i
MVC 0(6,R7),PG+126 output i
LA R7,6(R7) pgi=pgi+6
NEXT LA R6,1(R6) i=i+1
BCT R3,LOOP loop
XPRNT PG,120 print buffer
XR R15,R15 set return code
BR R14 return to caller
N DC F'12345' <== input value
PG DC CL132' ' buffer
YREGS
END FACTOR
You may also check:How to resolve the algorithm Time a function step by step in the Lingo programming language
You may also check:How to resolve the algorithm Caesar cipher step by step in the EDSAC order code programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Java programming language
You may also check:How to resolve the algorithm Lucas-Lehmer test step by step in the C# programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Peloton programming language