Question: Please do this in C++ or assembly language: Write a program that takes a positive number n as input. Then it prints all the numbers
Please do this in C++ or assembly language:
Write a program that takes a positive number n as input. Then it prints all the numbers x below n that have exactly 2 different integral divisors (Besides 1 and n).
For example, 15 is such a number. It is divisible by 1,3,5,15. (Here 3 and 5 are the two different divisors, besides 1 and 15).
However, 4 is not such a number. It is divisible by 1,2,4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If the user enters a negative number, you must display a message that you expect a positive number and you run the program again till the user enters a positive number.
You need to have a procedure called is2divisors. You may have more procedures if you like.
This procedure receives a number through one of the registers.
Check if this number has exactly 2 different integral divisors (Besides 1 and x).
Returns back (through one of the registers) to main program 1, if the number has exactly 2 different integral divisors (Besides 1 and x), 0 otherwise.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Global variables are allowed only inside main proc. It is ok to pass the values to your program through registers.
You must reserve any register you use inside your procedures, except the one you are returning to main.
You are not allowed to use "uses" and "pushAD" operator
Sample run:
enter a number: 16
All the numbers below your number that have exactly
2 different integral divisors (Besides 1 and the number) are: +6 +8 +10 +14 +15
Press any key to continue . . .
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
