Question: HELP NEEDED ASAP PLEASE. DEBUGGING The code below has five errors. The errors may be syntax errors or logic errors, and there may be more
HELP NEEDED ASAP PLEASE.
DEBUGGING
The code below has five errors. The errors may be syntax errors or logic errors, and there may be more than one per line; examine the code carefully to find them. Indicate each of the errors you find by writing the line number and correction in the space provided below.
You must find and correct all five of the errors.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include using namespace std; int main() { int num; bool prime = true; cout << "This program determines if a " << "number is prime" endl; // for this program, 0 does not count as positive while (num <= 0) { cout << "Enter a positive number: "; cin << num; } for(int i = 1; i < num; i++) { if (num % i == 0) { prime = false; } } if (prime = true) { cout << "The number " << num << " is prime." << endl; } else if { cout << "The number " << num << " is not prime." << endl; } } |
| Line Number | Correction |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
