This is my program:

#include <iostream> #include <math.h> using namespace std; int main() { double n, i; // 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 (i = 2.0; i <= sqrt(n); i++) // Test for prime by checking for divisibility by all whole numbers from 2 to sqrt(n). {if (n % i == 0.0) bool is_prime = false;} if (is_prime = true) { cout << "Number is prime." << endl; } else { cout << "Number is not prime." << endl; } system("PAUSE"); return 0; }

It is to show weather a number is prime or not.

On line 14:

{if (n % i == 0.0)

it says it is an invalid operant to types 'double and 'double'.

Please help, do I have to declare i or n as a float, int, long float, long

int, or long double? DAMNIT!!!