Question: assembly codeWrite a program to prompt the user for a number, and determine if that number is prime. Your program should print out Number n

assembly codeWrite a program to prompt the user for a number, and determine if that number is prime. Your program should print out "Numbernis prime" if the number is prime, and "Numbernis not prime if the number is not prime. The user should be able to enter a "-1" to end the problem. It should print an error if 0,1,2 or any negative number other than -1 are entered.
Write a program to find prime numbers from 3to n in a loop by dividing the number n by all
numbers from 2..n/2in an inner loop. Using the remainder (rem)operation, determine if n is
divisible by any number. If n is divisible, leave the inner loop. If the limit of n/2is reached
and the inner loop has not been exited, the number is prime and you should output the
number. So if the user were to enter 25,your program would print out "2,3,5,7,11,13,17,
19,23".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!