Question: Prime Number [ 1 0 points ] A prime number is a natural number that has only one and itself as a factors. 2 ,

Prime Number[10 points]
A prime number is a natural number that has only one and itself as a factors.
2,3,5,7,11, and 13 are a few prime numbers.
The above numbers can only be divided evenly by 1 or itself, so these numbers are prime numbers. The following is
a pseudo-code that can determine whether a number is prime or not:
int prime (int n){
int i, c =0;
for (i =1; i <= n; i++){
if (n % i ==0){
c++;
}
}
if (c ==2){
n is a Prime number.
}
else {
n is not a Prime number.
}
}
Task: Implement the above prime number algorithm in the x86 assembly language.
Requirements:
Input: You may hard-code your inputs (i.e., non-zero integer n) in the .data section. For example,
n BYTE 20
Output: Print the results using Irvine Library.

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!