answer.
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]
2 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]2 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
ACCOUNTING
ivann1987 [24]

last question is D

Hope this helps

7 0
2 years ago
Read 2 more answers
1. The precious metals needed to make computer chips, graphic cards, and transistors are found in only a small population of cou
dexar [7]

Answer:

it means that they can charge companies to come mine it making them more wealthy they can also upscale the materials needed to make it as they are the only countries that sell it so they have no one to compete with

3 0
2 years ago
Find true or false. A hacker is hacking software with access in sensitive information from your computer​
Alina [70]
ITS TRUE!!I SEARCHED IT
7 0
1 year ago
This question involves the creation of user names for an online system. A user name is created based on a user’s first and last
Evgen [1.6K]

Answer:

See explaination

Explanation:

import java.util.*;

class UserName{

ArrayList<String> possibleNames;

UserName(String firstName, String lastName){

if(this.isValidName(firstName) && this.isValidName(lastName)){

possibleNames = new ArrayList<String>();

for(int i=1;i<firstName.length()+1;i++){

possibleNames.add(lastName+firstName.substring(0,i));

}

}else{

System.out.println("firstName and lastName must contain letters only.");

}

}

public boolean isUsed(String name, String[] arr){

for(int i=0;i<arr.length;i++){

if(name.equals(arr[i]))

return true;

}

return false;

}

public void setAvailableUserNames(String[] usedNames){

String[] names = new String[this.possibleNames.size()];

names = this.possibleNames.toArray(names);

for(int i=0;i<usedNames.length;i++){

if(isUsed(usedNames[i],names)){

int index = this.possibleNames.indexOf(usedNames[i]);

this.possibleNames.remove(index);

names = new String[this.possibleNames.size()];

names = this.possibleNames.toArray(names);

}

}

}

public boolean isValidName(String str){

if(str.length()==0) return false;

for(int i=0;i<str.length();i++){

if(str.charAt(i)<'a'||str.charAt(i)>'z' && (str.charAt(i)<'A' || str.charAt(i)>'Z'))

return false;

}

return true;

}

public static void main(String[] args) {

UserName person1 = new UserName("john","smith");

System.out.println(person1.possibleNames);

String[] used = {"harta","hartm","harty"};

UserName person2 = new UserName("mary","hart");

System.out.println("possibleNames before removing: "+person2.possibleNames);

person2.setAvailableUserNames(used);

System.out.println("possibleNames after removing: "+person2.possibleNames);

}

}

8 0
2 years ago
When researching which keywords should be included in a résumé, what four sources are valuable resources?
zimovet [89]
I would suggest the following sources

1) job postings - those offer include the phrases that the employers themselves want to hear

2) keyword lists - they're made for looking for keywords!

3) professional site's skills sections. You could use LinkedIn or any other professional site.

4)Sometimes you can find software that can suggest keywords for you
4 0
2 years ago
Read 2 more answers
Other questions:
  • The adjusted cell references in a copied and pasted formula are called ____ cell references.
    7·1 answer
  • Prove that any amount of postage greater than or equal to 64 cents can be obtained using only 5-cent and 17-cent stamps?
    15·1 answer
  • "use the ______ element to create logical areas on a web page that are embedded within paragraphs or other block formatting elem
    15·1 answer
  • Which are examples of copyrighted online materials? Check all that apply.
    14·2 answers
  • Leena needs to manually update the TOC and would prefer not to change the styles in the document.
    9·2 answers
  • Identifying Characters
    11·2 answers
  • How many solutions exist for the given equation?
    9·1 answer
  • A blood bank maintains two tables - DONOR, with information about people who are willing to donate blood and ACCEPTOR, with info
    10·1 answer
  • How do many corporations most likely manage the health and safety of their employees and the workplace?
    13·1 answer
  • Write a method so that the main() code below can be replaced by simpler code that calls method calcMilesTraveled(). Original mai
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!