i successfully complied the code:
#include <stdio.h>
#include <math.h>
int q;
int main()
{
srand( time(NULL) );
int n=3;
q=ceil(sqrt(n));
printf("%d\n %d\n", n,q);
if(n == 2)
printf("%d\n is prime", n);
else if(n % 2 == 0.0 || n < 2)
printf("%d\n is not prime", n);
else
{
int x;
for(x = 0; x < q; x++){
if(n % x == 0)
{
printf("%d\n is not prime", n);
return;
}
else
printf("%d\n is prime", n);
}
}
}
but when i run it prints :Floating point exception
can u help me to fix this error