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]
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
Network topology is a direct representation of
ELEN [110]

Answer: network devices and their interconnecting links

Explanation: Network topology the representation of the layout of nodes in the network connections .The connections formed in the network topology includes the nodes, network devices, links etc.

Network topologies can be represented in many ways such as star topology , bus topology, mesh topology etc. It helps in the transferring of the data through the connection established.

7 0
2 years ago
Given that the variables x and y have already been declared and assigned values, write an expression that evaluates to true if x
Eduardwww [97]

Answer:

The expression to this question can be defined as follows:

Expression:

(x >= 0 && y<0) //check condition using AND operator

Explanation:

In the given question it is defined that x and y are an integer variable that holds some value, in which it defines a condition that checks the value of variable x is positive, and the value of y is negative.

  • To check positive value a condition is used, that checks x greater than equal to 0, and to check negative value, it uses condition, that is y is less than 0.
  • In the above condition, the AND operator is used, which executes when both conditions are true.
3 0
3 years ago
How to check the at&amp;t internet speed on my computer
Advocard [28]

Answer:

You can use the speedtest.net website. AT&T also has their own tool here: https://www.att.com/support/speedtest/

6 0
2 years ago
The title of a Web page is the text that appears on the title bar and taskbar of the browser window. *
forsale [732]

False

True

True

False

False

True

7 0
3 years ago
Using recursion, write a program that asks a user to enter the starting coordinates (row, then column), the ending coordinates (
Luden [163]

Answer:

The program in Python is as follows

def Paths(row,col):

if row ==0 or col==0:

 return 1

return (Paths(row-1, col) + Paths(row, col-1))

row = int(input("Row: "))

col = int(input("Column: "))

print("Paths: ", Paths(row,col))

Explanation:

This defines the function

def Paths(row,col):

If row or column is 0, the function returns 1

<em> if row ==0 or col==0: </em>

<em>  return 1 </em>

This calls the function recursively, as long as row and col are greater than 1

<em> return (Paths(row-1, col) + Paths(row, col-1))</em>

The main begins here

This prompts the user for rows

row = int(input("Row: "))

This prompts the user for columns

col = int(input("Column: "))

This calls the Paths function and prints the number of paths

print("Paths: ", Paths(row,col))

4 0
2 years ago
Other questions:
  • Which of these jobs would be most appropriate for someone who majors in computer engineering? I need the answer ASAP Helping com
    14·2 answers
  • ________ symbol is used in the "Advanced" section of the time range picker to round down to nearest unit of specified time.
    8·1 answer
  • How to check what level you are in runescape?
    9·2 answers
  • Help me plase will give brainliest
    12·2 answers
  • The Receiver recognizes the sounds the Sender is making and transforms them into words and ideas in his own mind. What is this
    5·1 answer
  • Linda wants to apply for a job in a company of her choice. Which information would her potential employers likely review in her
    10·2 answers
  • What can help an interface user understand or navigate an online interface?​
    15·1 answer
  • GRAND THEFT AUTO 5 LOLLL
    15·2 answers
  • Assume that the Vehicle class contains a virtual method named CalculateMaxSpeed(). Assume that both the MotorVehicle and Automob
    12·1 answer
  • Write a program that takes a string as an input. If the string entered is equal to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!