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
Which of the following best define grit
andreyandreev [35.5K]

Definition of Grit. According to researchers at the University of Penn- sylvania, grit is defined as "perseverance and passion for long-term goals.” Grit involves working strenuously to- ward challenges, maintaining effort and interest over years despite failure, adversity, and plateaus in progress.

Hope This Helps!      Have A Nice Day!!

8 0
3 years ago
Technology is often discovered by accident
polet [3.4K]

true. mots technology was found be accident

5 0
3 years ago
You can join tables by using a condition in the ____ clause.​
andre [41]
You can join tables by using a condition in the "where" clause.
4 0
3 years ago
5255555555555+55555555555555/1111*99442
Marina CMI [18]

Answer:

(502763134343429265 /101)

Explanation:

7 0
4 years ago
Read 2 more answers
write a program with total change amount as an integer input and output the change using the fewest coins, one coin type per lin
notka56 [123]

Answer:

Explanationoojhh

8 0
3 years ago
Other questions:
  • 1).
    12·1 answer
  • What is computer engineering?
    11·1 answer
  • One type of technology that can verify a person's identity is _____.
    6·2 answers
  • What would happen if a pc that contains a power supply that does not automatically adjust for input voltage is set to 230 volts
    13·1 answer
  • Which are valid double statements for java? double a = 0; double b = -1.0; double c = -425; double d = 6340; double e = -1.0; do
    12·2 answers
  • Even though a high-level programming language
    11·1 answer
  • [This is on Edhesive (coding and programming)]
    8·2 answers
  • In this lab you will learn about the concept of Normal Forms for refining your database design. You will then apply the normaliz
    15·1 answer
  • Question # 6
    11·2 answers
  • Question # 1
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!