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
olya-2409 [2.1K]
3 years ago
14

g Design a Boolean function called isPrime, that accepts an integer as an argument and returns True if the argument is a prime n

umber, or False otherwise. Use the function in a program that prompts the user to enter a number and then displays a message indicating whether the number is prime. The following modules should be written
Computers and Technology
1 answer:
professor190 [17]3 years ago
4 0

Answer:

#include <bits/stdc++.h>

using namespace std;

bool isPrime(int n)

{

   for(int j=2;j<=n-1;j++)  //loop to check prime..

   {

       if(n%j==0)

       return false;

   }

   return true;

}

int main(){

   int n;

   cout<<"Enter the integer"<<endl;//taking input..

   cin>>n;

   if(isPrime(n))//printing the message.

   {

       cout<<"The number you have entered is prime"<<endl;

   }

   else

   {

       cout<<"The number is not prime"<<endl;

   }

return 0;

}

Output:-

Enter the integer

13

The number you have entered is prime

Explanation:

The above written program is in C++.I have created a function called isPrime with an argument n.I have used a for loop to check if the number is prime or not.In the main function I have called the function isPrime for checking the number is prime or not.

You might be interested in
What are the advantages of AI?????
mr Goodwill [35]
AI is a technology that can do thing that humans are doing. So in future humans don’t have to these AI will do it for us.
4 0
3 years ago
How do you fix The lag on your zsnes emulator
GenaCL600 [577]
Try resetting the phone if that doesn’t work do a hard reset
7 0
3 years ago
Plzzzzz help me with this and be serious dont comment random things
RoseWind [281]

Answer:

legal and ethical questions

brick and mortar guidelines

website content

customer information

the facts of life

payment processing

human resources

this is in career explorations 2 please help will mark the brainiest ​

Explanation: yes he is right this is correct

7 0
3 years ago
What does OSS mean? ??
Viefleur [7K]
Ooeration support system. OSS is IT for running a communications network.
6 0
3 years ago
What does clob stand for
Lena [83]
CLOB stands for character large objects, which are used to store string data too large to be stored in a VARCHAR column
7 0
3 years ago
Read 2 more answers
Other questions:
  • Ben works at a top accounting firm in Salt Lake City and his responsibilities include developing individual and departmental goa
    9·1 answer
  • What is data protection
    13·1 answer
  • Why do contour lines never cross?
    5·1 answer
  • Which of the following topics is too broad for a 10-minute speech? A. classes offered in interior design B. the history of moder
    13·2 answers
  • Please list ten things that you have learned an Excel Spreadsheet can do.
    7·1 answer
  • Describe how electrons move between atoms to create electricity.
    7·2 answers
  • What is the name of the item that supplies the exact or near exact voltage at the required wattage to all of the circuitry insid
    14·1 answer
  • I need to create a method named "root positive". which will either print the square root of the number passed to it or if the nu
    13·1 answer
  • Which attributes are indicators that a website is reliable? Check all that apply is up to date explains sources of data is an ed
    10·1 answer
  • In addition to developing sketches, computer-aided design programs are used by fashion designers to perform which task?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!