An assembler code. A general example code attached to ensure correct format and platform.
The code asks user to input an 8 digit number, and then checks if it is a prime or not according to following algorithm. If it's not a prime, the smallest dividor is displayed.
## Deliverables
The format should be as the attached code (the code is not for the required task, just as an example for the format and platform).
The program will ask the user to input an number with up to 8 digits (in order to be able to represent as 32 bit).
If the number is found to be a prime, the program will display a message.
If the number is not a prime, the program will display its smallest dividor.
The method to check if the number is a prime:
- check if the number is 2. If so, it is a prime.
- check if the number divides by 2. If so, it's not a prime and 2 is its smallest dividor.
- if not, j=3:
as long as j*j<n: if j divides n without reminder, then j is n's smallest dividor. if not, j=j+2 and check again.
The code should be compiled and linked using TASM and TLINK complier and linker.
Thanks.
## Platform
Windows XP, using compiler and linker TASM and TLINK.