Question: C++ 4) Place this program in a while loops, so you can run it as many times as you want. It determines prime numbers. #include

C++

4) Place this program in a while loops, so you can run it as many times as you want. It determines prime numbers. #include #include using namespace std; int main(void) { int i = 0,j = 0,k = 0; double n = 0; cout << "Enter a number: "; cin >> n ; cout << "The prime numbers form 2 to " << n << "are " << endl; for(i=2;i<=n;i++) { k=0; for(j=1;j<=i;j++) if(i%j==0) k++; if(k==2) cout << ", " << i; } return 0; } Use filename: week12YourNameWhile4ProgPrime

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!