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
Andrina writes letters that are regularly sent to hundreds of her company’s customers. Because of this, she would like for the M
galben [10]

The correct answer is A.

7 0
3 years ago
PLEASE HELP ITS CODING AND I INCLUDED A SCREENSHOT OF WHAT TO DO
Anettt [7]

def even_checker(lst):

   for x in lst:

       if x%2==0:

           print(x)

l = [1,2,3,4,5,6,7,8,9,10]

even_checker(l)

I wrote my code in python 3.8. I hope this helps.

3 0
3 years ago
Given two integer variables matricAge and gradAge, write a statement that gives gradAge a value that is 4 more than the value of
Natasha_Volkova [10]

Answer:

gradAge=matricAge+4;//Statement to give gradAge a value 4 more than matricAge.

Explanation:

This statement assigns the value stored in the matricAge variable with 4 added to it.So the value assigned to the gradAge is 4 more than value of matricAge.We have used assignment operator(=) to do this.Assignment operator assigns the value/variable's value written in the right to the variable to the left.

8 0
3 years ago
Please help me please and thank you!
MaRussiya [10]

Answer:

1. a digital designer involves movement like animations, movies, etc. A graphic designer is static for an example logos pictures etc.

2. a ux is the interaction between humans and products

3.  a ui is the design of software and machines, for an example computers, electronic devices, etc.

4.  textures, color, value, and space

5. the basics are contrast, balance, emphasis, white space, hierarchy, movement, proportion, repetition, pattern, variety, unity, and rhythm

6. the basic fundamentals are images, color theory, lay-out, shapes, and typograph  

I hope this helped you and have a great rest of your day

7 0
3 years ago
This isn't a homework question but rather a technological problem. I connected my device to the motherboard but it will not dete
Helen [10]
Re start the computer again
5 0
4 years ago
Read 2 more answers
Other questions:
  • I'm curious why I would need to know this on a school learning site.
    12·1 answer
  • Write a function called calculate() that accepts three integer Numbers as arguments, compute these values : Sum and Product and
    7·1 answer
  • if image size and resolution are the same, which file format, .jpg, .gif, .or .tiff, will give you the smallest file size?
    8·2 answers
  • Suppose for the worst case, given input size n: Algorithm 1 performs f(n) = n2 + n/2 steps Algorithm 2 performs f(n) = 12n + 500
    6·1 answer
  • Representations and Conversions
    8·1 answer
  • For Excel:
    5·1 answer
  • What are two major techniques involved in green computing
    10·1 answer
  • Why was the cooper black font made?
    5·1 answer
  • Filtering data in Excel Online keeps all data on the screen and highlights the content that fits your criteria.
    9·1 answer
  • What statement is accurate in regards to
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!