I wrote this code for c++ on Dev C++ and it says my ??WHILE?? phrase is incorrect Please help.
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n; //number to test for primeness
int i; //loop counter
int is_prime = true; //Boolean flag...
//assume true for now
//Get a number from the keyboard
cout << "Enter a number and press ENTER:";
cin >> n;
//Test for prime by checking for divisibilitty.
//by alll whole numbers from 2 to sqrt(n).
i = 2;
while (i <= sqrt(n) ) { //while i is <= sqrt(n)
if (n % i == 0) // if i divides n.
is_prime = false; // n is not prime
i++; //add 1 to i
}
//print results
if (is_prime)
cout << "Number is prime." << endl;
else
cout << "Number is not prime." << endl;