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
the 4gl languages that enable nonprogrammers to use certain easily understood commands to search and generate reports from a dat
Mademuasel [1]

The 4gl languages that enable non-programmers to use certain easily understood commands to search and generate reports from a database are called <u>query</u>.

<h3>What is 4gl?</h3>

A computer programming language that is part of a class that is intended to improve upon third-generation programming languages (3GL) is known as a fourth-generation programming language (or 4GL).

Every generation of programming language strives to provide a greater level of abstraction of the internal workings of the computer hardware, making the language more user-friendly, potent, and adaptable.

Despite the fact that the definition of 4GL has evolved over time, it can still be characterized by the fact that it works more with large groups of data at once rather than concentrating on just bits and bytes.

The support for report generation, database management, mathematical optimization, GUI development, and web development may be found in languages that advertise themselves as 4GL. According to some academics, domain-specific languages include 4GLs as a subset.

Learn more about 4GL

brainly.com/question/9978575

#SPJ4

3 0
1 year ago
What changes can be done using image editing tool?<br> a) Resize b) Crop c) Resize and crop
qaws [65]
The answer is C
Most of these image editing tools allow you to crop, rotate, adjust brightness, contrast and color, touch up and add filters to photos .
5 0
3 years ago
The batteries on electric vehicles are recharged using electricity from either a wall socket or dedicated charging unit.
yuradex [85]

Answer:

true

Explanation:

7 0
2 years ago
Computer science is a blank process
PSYCHO15rus [73]

i agree... its a interesting thing to learn, just like learning an actual new language.

4 0
2 years ago
Read 2 more answers
Write a program that reads a series of strings andprints only those strings beginning with the letter "b."
coldgirl [10]

Answer:

#include <iostream>

using namespace std;

int main()

{

char str[100][20];

int n;

cout<<"Strings you want to enter"<<endl;

cin>>n;

cout<<"enter n strings"<<endl;

for(int i=0;i<n;i++)

cin>>str[i];

for(int i=0;i<n;i++)

{

if((int)str[i][0]==98) //ascii value b is 98

cout<<str[i]<<endl;

}

return 0;

}

Explanation:

The above written code is for printing the strings which starts with the letter b.

To check if the string starts with a letter b we are checking the ascii value 98 which corresponds to b and then printing those strings.

6 0
3 years ago
Other questions:
  • If you print a document with red green or blue underlines will they show up on printed pages
    14·1 answer
  • What are you guys doing?
    13·2 answers
  • Suppose you wanted to run a web server or ftp server from your home. what type of ip address would you want?​
    6·1 answer
  • Which one of the following characteristics or skills of a ScrumMaster are closelyaligned with coaching?Select one:
    5·1 answer
  • In 1-2 pages, identify a social networking technology and identify at least 10 security and/or privacy risks the technology has
    8·1 answer
  • What is the importance of eliminating marks that classify a master key
    7·1 answer
  • You are moving to an area where DSL will be available in the next six months. Which method of internet connectivity should you i
    13·1 answer
  • Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correc
    9·2 answers
  • Write a application that can determine if a 5 digit number you input is a palindrome. If the number is a palindrome then print "
    14·1 answer
  • HELPPP PLEASE <br><br> Html can be used to create complicated mobile applications <br> True or false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!