ilovepie10 - 2011-12-24

I am trying to compile this program:

#include <iostream>
#include <cmath>
using namespace std;

int main() {
    double n;   // Declaring variable i and n 
    bool is_prime = true; // Boolean flag; assume true until proven otherwise

    cout << "Enter a number and press ENTER: ";
    cin >> n;

    for (int i = 2; i <= sqrt(n) && n%i == 0; i++)   // Test for prime by checking for divisibility by all whole numbers from 2 to sqrt(n).
    {bool is_prime = false;}

    if (is_prime = true) {
        cout << "Number is prime." << endl;
    }
    else {
        cout << "Number is not prime." << endl;
    }
    system("PAUSE");
    return 0;
    }

Only to have line 12

for (int i = 2; i <= sqrt(n) && n%i == 0; i++)

have an error message of : invalid operants of type 'double' and

Please help!