1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
geniusboy [140]
2 years ago
5

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
Computers and Technology
1 answer:
Alexandra [31]2 years ago
8 0

Answer:

is c

Explanation:

You might be interested in
In a relational database design, all relationships are expressed by ________.
velikii [3]
Explain what is meant by a limited data set and how this HIPAA rule may affect medical assistants
8 0
3 years ago
write a c++ program that takes a string input from the user and removes all characters except numerals also display the number o
Xelga [282]

Answer:

hi

Explanation:

5 0
3 years ago
In C++ we can print message for the user in Arabic?<br><br> A. True<br> B. False
Lynna [10]

Answer:

A

Explanation:

8 0
2 years ago
It is easy to create good photographs of mountains because you can always tell how big they are. True False
Tanya [424]

False

From afar it may be difficult to be sure how big the mountains actually are

5 0
3 years ago
Read 2 more answers
Write code statements that prompt for and read a double value from the user, and then print the result of raising that value to
andriy [413]

Answer:

Following are the code in Java Language:

Scanner sc = new Scanner(System.in); // create a instance of scanner class

DecimalFormat frmt = new DecimalFormat("0.###"); // create a instance of                // DecimalFormat class

System.out.println ("Enter the value: ");

double number = scan.nextDouble(); // Read the value by thje user

System.out.println (fmmt.format(Math.pow(number, 4))); // display the value

Explanation:

Following are the description of the code

  • Create an instance scanner class i.e "sc".
  • Create an instance of DecimalFormat class i.e "frmt".
  • Read the value by the user in the "number" variable of type double by using the nextDouble()method.
  • Finally, display the value by using System.out.println method. In this, we call the method format. The Math.pow() function is used to calculating the power up to the fourth value.

5 0
3 years ago
Other questions:
  • (Drag each tile to the correct box)While surfing online, Patricia first checks her email and reads the latest messages. She then
    8·1 answer
  • The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult meal
    8·1 answer
  • How do you uninstall a program using the Control Panel?
    10·1 answer
  • If a full disk encryption (FDE) password is forgotten, what can be incorporated to securely store the encryption key to unlock t
    13·1 answer
  • What is a computer network?
    5·1 answer
  • A relative path name defines a path from_________________________ Select one: a. from the UFD (user file directory) b. the curre
    6·1 answer
  • If your internet were to go out, what steps would you take to troubleshoot to restore your service?
    15·1 answer
  • Which of these Logic Statement's are correct for the following diagram? *
    5·1 answer
  • Please select the word from the list that best fits the definition Asking for review material for a test
    14·2 answers
  • WAp to input the radius and print<br> the area of circle
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!