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
Aliun [14]
3 years ago
14

Create a function named test2Problem2that contains a list comprehension. This function will take asingle integer parameter nand

returns a list of length n of every other prime. (Please note that primes start at 2.)There will be a 10 point deduction for not using a list comprehension to solve this problem.List comprehensions have this form: [ expression for item in list if conditional ]In:10Out:[2,5,11,17,23,31,41,47,59,67]In:7Out:[2,5,11,17,23,31,41]
Computers and Technology
1 answer:
ikadub [295]3 years ago
3 0

Answer:

C++.

Explanation:

#include <iostream>

using namespace std;

/////////////////////////////////////////////////////////

void printPrime(int n) {

   if (n > 0) {

       cout<<"[2";

       for (int i=3; i<=n; i++) {

           bool isPrime = true;

           

           for (int j=2; j<i; j++) {

               if (i % j == 0) {

                   isPrime = false;

                   break;

               }

           }

           

           if (isPrime == true)

               cout<<", "<<i;

       }

   }

   else {

       cout<<"Invalid input";

   }

   cout<<"]";

}

/////////////////////////////////////////////////////////

int main() {

   int n;

   cout<<"Enter positive integer: ";

   cin>>n;

   printPrime(n);

   return 0;

}

You might be interested in
Create and execute a SELECT statement that would provide data for a vendor directory. Display should include vendor number, vend
Luba_88 [7]

Answer:

SELECT vendor_number, vendor_name, CONCAT ('street', ' ' , 'city', ' ' , 'state', ' ' , 'zip code') as adress

FROM vendor_directory

ORDER BY vendor_name ASC;

Explanation:

* Suppose <u>vendor_directory</u> is the name of the table from which you extract the data with the SELECT sentence.

8 0
3 years ago
Which attributes does not come in tag?
Ne4ueva [31]

Answer:

length is your answer

Explanation:

Have a great day! ^-^

can you me as brainliest if its right? i need 10000 points and 35 brainliest's to rank up to genius

4 0
3 years ago
Read 2 more answers
Which of the following is an example of constructive criticism for a friend who speaks too softly?
Dmitry [639]
C is correct..

Please vote my answer branliest! Thanks.
8 0
3 years ago
Read 2 more answers
Compiler software has a stepping function that
just olya [345]

Answer:

Runs code line by line to help developers find bugs.

Explanation:

I took the test.

3 0
3 years ago
Read 2 more answers
Why did we decide to send a message as a sequence of two options rather than modifying our devices to represent more options?
yaroslaw [1]

Answer:

Following are the solution to this question:

Explanation:

Please find the complete question in the attachment file.

The binary message is also an XML text SMS, which is used to represent in binary character. It may also flag the binary text as binary, and it can attach the UDH as just the start of its message. In this question, we assume that you can include A and B because there could be no more than 2 choices in such a binary message.

8 0
3 years ago
Other questions:
  • How is a Personal Fact Sheet used? a. A Personal Fact Sheet is a tool used to market yourself and build your network b. A Person
    13·2 answers
  • If directory server a trusts directory server b, directory server b trusts directory server c, and directory server a trusts dir
    6·1 answer
  • In order to plan George's birthday, his father gave him a list of people who attended his birthday for the last five years. What
    5·1 answer
  • The person in charge of recording the sound should always
    15·1 answer
  • Why are new versions of applications packages released often ​
    9·1 answer
  • When Twitter is used to gather a large group for a face-to-face meeting it is called
    10·1 answer
  • What is the result of expression 15 &gt; 10 &gt; 5 in C? What is the result of the same expression in Java?
    14·1 answer
  • What are the origins of the parking barrier?
    12·1 answer
  • What does this function do in the code?
    5·2 answers
  • What is an example of work performed by an integration platform as a service (ipaas)?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!