subject

A prime number is an integer that is divisible only by 1 and by itself. Write a program that: 1. Takes a number as an input. 2. Prints back to the console all the primes that are larger than 1 but not larger than the number that has been entered. You need to have a procedure called isPrime. You may have more procedures if you like. 1. This procedure receives a number through one of the registers. 2. Checks if this number is prime. 3. Returns back through one of the registers to the main program 1, if the number is prime, 0 otherwise. sample run: Please enter a number: 44 Primes found until the given number: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 Press any key to continue .
This is an assembly language assignment. The first they want me to write as c++ and I write it and then I have to translate into the assembly. How I can do that?
This is the code as c++
include Irvine32.inc

.data
string1 "Please enter a number:"
string2 "Primes found until given number:"

.code
main Proc
#include
using namespace std;
bool isPrime(int num);
int main()
{
int num;
bool val;
cout<<"enter a number";
cin>>num;
val=isPrime(num);
if(val==true)
cout<<"It is a prime Number";
else
cout<<"It is not a prime number";
return 0;
}
bool isPrime(int num)
{
int i, count=0;
for(i=2;i<=num;i++){
if(num%i==0)
count++;
}
if(count==2)
return true;
else
return false;
}

exit
main endp
end main

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:00
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select “state” under field name, then type in the state name under “equal to”
Answers: 2
question
Computers and Technology, 23.06.2019 04:00
Write a method that takes in an array of point2d objects, and then analyzes the dataset to find points that are close together. be sure to review the point2d api. in your method, if the distance between any pair of points is less than 10, display the distance and the (x,y)s of each point. for example, "the distance between (3,5) and (8,9) is 6.40312." the complete api for the point2d adt may be viewed at ~pf/sedgewick-wayne/algs4/documentation/point2d.html (links to an external site.)links to an external site.. try to write your program directly from the api - do not review the adt's source code.
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
1. which of these is not true about torsion bars? a. they can be used to adjust ride height b. they can be adjusted anytime since they don't affect alignment angles c. they attach between the frame and the lower control arm d. they twist to produce a spring effect
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
Once a vulnerability has been identified by nessus, where would you check for more information regarding the identified vulnerability, exploits, and any risk mitigation solution?
Answers: 1
You know the right answer?
A prime number is an integer that is divisible only by 1 and by itself. Write a program that: 1. Tak...
Questions
question
History, 22.10.2019 04:30
question
Mathematics, 22.10.2019 04:30
question
Mathematics, 22.10.2019 04:30
Questions on the website: 13722361