Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

2. Discuss the steps in preparing a manager to go overseas.

Answered: 1 week ago

Question

8. Measure the effectiveness of the succession planning process.

Answered: 1 week ago