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
icang [17]
3 years ago
11

#Write a function called is_composite. is_composite should #take as input one integer. It should return True if the #integer is

composite, False if the integer is not not #composite. You may assume the integer will be greater than #2 and less than 1000.
Computers and Technology
1 answer:
malfutka [58]3 years ago
3 0

Answer:

// A optimized school method based C++ program to check  

// if a number is composite.  

#include <bits/stdc++.h>  

using namespace std;  

bool isComposite(int n)  

{  

// Corner cases  

if (n <= 1) return false;  

if (n <= 3) return false;  

// This is checked so that we can skip  

// middle five numbers in below loop  

if (n%2 == 0 || n%3 == 0) return true;  

for (int i=5; i*i<=n; i=i+6)  

 if (n%i == 0 || n%(i+2) == 0)  

 return true;  

return false;  

}  

// Driver Program to test above function  

int main()  

{  

isComposite(11)? cout << " true\n": cout << " false\n";  

isComposite(15)? cout << " true\n": cout << " false\n";  

return 0;  

}

Explanation:

You might be interested in
Generally speaking, what is a “best practice"?
miss Akunina [59]

Answer:

What’s up, I’m currently in this class, and I was wondering if it’s easy or hard?

Explanation:

3 0
3 years ago
Double click on a sheet tab to ______ the sheer
Anni [7]

its delete cuz i just tryed it now and i think im right if im wrong forgive me


8 0
3 years ago
Read 2 more answers
You can print powerpoint presentation handouts with up to ____ slides per page.
Ierofanga [76]
You can print up to 9 slides per page.
3 0
4 years ago
To create an instance of Big Decimal for 454.45, use ________.
agasfer [191]

Answer:

C.

Explanation:

Based on the Java documentation; when creating an instance of BigDecimal, we can pass a string as a constructor.

System.out.println(new BigDecimal("454.45"));

8 0
4 years ago
A crosstab query calculates aggregate functions in which field values are grouped by _____ field(s).
Juli2301 [7.4K]

Answer:

2

Explanation:jjjj

8 0
2 years ago
Other questions:
  • Siva added a Contact Form to her website. This is used for the collection to be included in
    5·1 answer
  • What are the basic steps in creating a new program
    5·1 answer
  • Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
    7·1 answer
  • What best describes a firewall
    11·1 answer
  • Which statement is NOT true regarding regular expression quantifiers? Group of answer choices They act on the preceding pattern
    11·1 answer
  • The method "someOtherMethod" is NOT defined as static. This means...
    5·1 answer
  • The following procedure is intended to return the number of times the value val appears in the list nylist. The procedure does n
    15·2 answers
  • SOMEONE HELP ME PLEASE <br> What are three reasons technology is beneficial to teens
    11·1 answer
  • when doing a complex presentation which of the fallowing will be the best tool to begin designing your presentation
    12·2 answers
  • Im trying to do an animation only using simplegui in python and my objective is make the ball enters frame, be confused and jump
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!