Please answer the following in PSUEDOCODE and not C or C++. The actual working p
ID: 3771017 • Letter: P
Question
Please answer the following in PSUEDOCODE and not C or C++. The actual working problem is not needed, just the psuedocode! Thanks!
1. Write psuedocode for a program that will read in a positive integer and print all of the factors of the number. Note: Factors are numbers that divide evenly into the number. To simulate modulus, we use the % symbol.
2. Write psudocode for a program that reads in two positive integers and prints out the least common multiple (LCM). The least common multiple is the number that both positive integers divide into evenly.
Explanation / Answer
1.
start
enter positive integer
accept it in a varable n
set a variable i=2
while i is less than n
check if n % i is 0
print i
increment i by 1
stop
2.
start
enter 2 positive integer
accept it in a varable a and b
set variable i=2
while i is less than a or b
check if a % i is 0 and b % i is 0
print i
increment i by 1
stop