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 commands does SuperKarel know that regular Karel does not?
luda_lava [24]

Answer:

turnRight and turnaround

Explanation:

The regular karel does not know these commands

5 0
2 years ago
If I use google incognito mode or a throwaway google account can my search history be tracked by Microsoft parental controls?
3241004551 [841]

nu it would not but if they call microsoft to check it then yez the history would show up for them but dont try to make it notice able so they dont have to call

6 0
2 years ago
________is one of the most popular payment gateways founded in in December 1998​
iren2701 [21]

paypel is the most popular

6 0
3 years ago
What Hulu shows should I watch? Actually answer tho.
Alina [70]
Mmmmmmm Utopia falls
3 0
3 years ago
Read 2 more answers
Circuitry can be either basic or ___________.
Sonja [21]
I think it would be A. Ohm's law.
hope this helps.
6 0
3 years ago
Read 2 more answers
Other questions:
  • Use a colon before a list and put one space after a colon. True False
    15·2 answers
  • Betty took her friends bowling. they rented 4 lane. 10 people need rent shoes and
    12·1 answer
  • What are the different components of the cloud architecture?
    5·2 answers
  • Sorry to bother you guys but for some reason it wont let me comment. How can i fix this?
    5·2 answers
  • A program requires that you change your screen size from 1024 X 728 to 800 X 600. In which of the following locations should you
    7·2 answers
  • What is the FaFASA4caster used for
    10·1 answer
  • Please anyone, help me.... I'm not sure how to put these all together.<br> 35 points!
    15·2 answers
  • A period in which unemployment is low, business produces many goods and services, and wages are good is called ______.
    8·1 answer
  • A while loop should be used if you want the user to watch the same video three times.
    13·1 answer
  • you want to be able to restrict values allowed in a cell and need to create a drop-down list of values from which users can choo
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!