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
Orlov [11]
4 years ago
13

A prime number is an integer greater than 1 that is evenly divisible by only 1 and itself. For example, the number 5 is prime be

cause it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided by 1, 2, 3, and 6. Write a Boolean function named isPrime, which takes an integer as an argument and returns true if the argument is a prime number, and false otherwise.

Computers and Technology
2 answers:
Natasha_Volkova [10]4 years ago
3 0

Answer:

Since no programming language is stated, python will by used.

Explanation:

def  isPrime():

#first we ask for a number that will be tested

   data= int(input("please enter a number"))

#the next line is where the number will be tested to see if its a prime

   if (data>1):

       if(data % 2)==1:

           print("true")

       else:

           print("False")

   else:

       print("Enter a number greater than 1")

isPrime()

ELEN [110]4 years ago
3 0

Answer:

I am writing a C++ program.    

bool isPrime(int integer)  //boolean function that takes integer argument //and returns true if argument is prime number otherwise false

{  if (integer > 1)  // if the integer value is greater than 1

{   for (int i = 2; i <= integer; ++i)  

//loop starts from 2 and iterates until the value of i gets greater than integer //value

 {  if (integer % i == 0)  // if integer value is completely divisible by i

  {    if(integer == i)  // if integer value is equal to i

    return true;  //function returns true

   else     //if integer value is not divisible by i

    return false;  //function returns false } } } }  }

 

Explanation:

In order to see the output of the program you can write a main() function as following:

int main()  {  //start of the main() function body

int integer;    // int type variable integer

cout<< "Enter an integer:  ";  //prompts user to enter an integer value

 cin  >> integer;   //reads the input from user

cout << integer<<" ";   //prints the integer value entered by user

if (isPrime(integer))  

// calls boolean function to check if the integer value is prime number or not

{   cout << " is a Prime number." << endl;   }

//displays the message number is prime

else  //if the integer value is not prime

 cout << " is not a Prime number." << endl;  }  //displays message

The output along with the program is attached as screenshot.

You might be interested in
WHERE DO I GO TO DO THIS AND WHAT DO I WRITE?????
faust18 [17]

You can just look up "python ide online" on google and paste this code:

n = -1

count = 0

while n < 0:

   n = int(input("We're checking to see if a number is prime or not! Enter a positive number: "))

if n % 2 == 0:

   if n == 2:

       print("{} is a prime number".format(n))

   else:

       print("{} is not a prime number".format(n))

else:

   for x in range(n, 1, -1):

       if n % x == 0:

           count += 1

   if count > 1 or n == 1:

       print("{} is not a prime number".format(n))

   else:

       print("{} is a prime number".format(n))

I've written some code that checks to see if a number entered by the user is a prime number or not.

Sorry, but I'm not too good with pseudocode plans and all that. I hope this helps.

8 0
3 years ago
Read 2 more answers
What are chemical manufacturers required to provide to anyone who purchases or uses their chemicals for a work purpose? Select a
Julli [10]

Answer:

Labels and Safety Data Sheets.

Explanation:

Label is a short description of what is inside the container. And Safety Data Sheets has everything that is required. You have precautionary measures listed as well as the training details in the safety data sheets. The training PPE is hence not required definitely. However, the only other thing required is the label, as without that you will not come to know what is inside the container from outside. Hence, the above answer.

8 0
3 years ago
Read 2 more answers
Explains your analysis of the impacts of this new internet distribution on people and businesses.
Anika [276]

Answer:

A business' ability to communicate with its employees, customers and associates changed dramatically when the Internet yielded new communication tools. Email and instant messaging have changed the face of business communication.

8 0
2 years ago
a blank search examines the first item to see if it is a match, then the second, and so on. answers: linear, binary, and orderly
Mazyrski [523]

Answer:

The answer is a linear search

Explanation:

3 0
3 years ago
Read 2 more answers
Mark each statement as true or false: a. PATA hard drives are older and slower than SATA hard drives. b. SATA1 is about 10 times
deff fn [24]

Answer:

The answer to this question can be described as follows:

a) True

b) False

c) False

d) False

e) False

f) True

Explanation:

In option a,  PATA device is used to connect the hard drives into systems.  Its title suggests, depends on parallel transmitting technology, contrasted to the compulsive-signaling tools.

In option b, SATA1 is a first-generation device, and SATA3 third generation, that's why it is wrong.

In option c and option d, both were wrong because RAID 0 and RAID 5 are Cloud computing software for storing data.

In option e, An internal SATA data cable with an eSATA port can not be used as an additional connection is provided by the eSATA port.

In option f, It is true because there are 7 pins in internal SATA.

6 0
3 years ago
Other questions:
  • To include all fields in a sql query, use the ____ symbol after the word select.
    7·1 answer
  • What is computer engineering?
    11·1 answer
  • answer for brainliest Today, trending current events are often present on websites. Which of the following early developments in
    15·1 answer
  • The SmoothWall open source firewall solution uses colors to differentiate networks. Which color indicates the private, trusted s
    9·1 answer
  • EVERYONE PLS JOIN MY GOOGLE CLASSROOM<br> CODE: clmvjbd
    13·2 answers
  • Kendra is taking a class in Finance and she has been asked to give a speech about a case study in which she's been working. She
    5·1 answer
  • Explain the working principal of computer system with suitable diagarm​
    9·1 answer
  • I NEED HELP W/ BINARY NUMBERS ‼️⚠️‼️⚠️‼️⚠️‼️ DUE IN 15 MINUTES
    13·2 answers
  • Select the correct text in the passage.
    15·1 answer
  • Which of the following could be part of an algorithm?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!