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
________ is the process of translating a task into a series of commands that a computer will use to perform the task.
IgorC [24]
Programming 
It can also be described as Reverse Engineering 
7 0
3 years ago
You are assigned by your teacher to perform the assembly of all the parts of the computer in preparation for the hands on activi
Alexus [3.1K]

Answer:

answer it yourself or ask your teacker

Explanation:

7 0
2 years ago
What is the simplest way to permanently get rid of an unwanted file? A. Go to the Start menu and then delete the file. B. Erase
vazorg [7]

C. Send it to the recycle bin and empty the recycle bin
7 0
3 years ago
When a linked chain contains nodes that reference both the next node and the previous node, it is called a(n)?
Nuetrik [128]

Doubly linked chain

When a linked chain contains nodes that reference both the next node and the previous node, it is called a doubly linked chain. This type of chain is often used in data structures because it provides a way to easily traverse the data in both directions. However, because each node must reference both the next node and the previous node, doubly linked chains require more memory than singly linked chains.

Learn more here:

brainly.com/question/13100699

#SPJ4

6 0
1 year ago
Write a java program called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the numbe
Vlada [557]

Answer:

public class Digits

{

   public static boolean allDigitsOdd(int num)

   {

       boolean flag=true;

       int rem;

       while(num>0)

       {

           rem=num%10;

           num=num/10;

           if(rem%2==0)    // if a even digit found immediately breaks out of loop

           {

               flag=false;

               break;

           }

       }

       return flag;     //returns result

   }

   public static void main(String args[])

   {

       System.out.println(allDigitsOdd(1375));    //returns true as all are odd digits

   }

}

OUTPUT :

true

Explanation:

Above program has 2 static methods inside a class Digits. Logic behind above function is that a number is divided by 10 until it is less than 0. Each time its remainder by 0 is checked if even immediately breaks out of the loop.

4 0
3 years ago
Other questions:
  • On an open book test, Anna was asked to predict how American laws may affect the Mexican way of life if the US Constitution was
    15·1 answer
  • You can use the results from a search on a database in all of these ways except to ____.
    11·2 answers
  • Create a java class for Bank Accounts with these public String attributes: ownerName, acctNbr and these private double attribute
    11·1 answer
  • Banking Account
    9·1 answer
  • Katarina is deciding whether to buy a desktop or a laptop computer. What will most likely help Katarina make her decision?
    10·2 answers
  • We use a cubic equation in which the variables and coefficients all take on values in the set of integers from 0 through p - 1 a
    8·1 answer
  • Write an assembly program that will prompt the user for 3 inputs (let’s abstractly call them a, b, and c) without a leading stri
    13·1 answer
  • What error occurs in the following program? #include using namespace std; int main() { int number1, number2, sum; cout &lt;&lt;
    13·1 answer
  • Is anyone else having issues with brainly not working? Everytime I click on a answer it only comes up with the 7 month trail thi
    12·1 answer
  • Three materials needed to stream video video content
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!