27.0k views
5 votes
#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.

1 Answer

6 votes

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)

// Driver Program to test above function

int main()

{

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

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

return 0;

}

Step-by-step explanation:

User BriteSponge
by
6.2k points