Can somebody explain me what is wrong with my code and why SPOJ judgde system does not want to accept it ?
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
int main()
{
bool isPrime=true;
int test;
scanf("%d", &test);
for(int i=sqrt(test);i>1;i–)
{
if (test%i==0)
{
isPrime=false;
}
}
if (isPrime)
{
printf("%d\n", test);
}
isPrime=true;
int first,second;
int result;
for(int i=0;i<2;i++)
{
scanf("%d",&first);
scanf("%d",&second);
if(first==1)
{
first=2;
}
for(int i=first;i<=second;i++)
{
for(int i = sqrt(first);i>1;i–)
{
result=first%i;
if (result==0)
{
isPrime=false;
}
}
if(isPrime)
{
printf("%d “, first);
}
isPrime=true;
first++;
}
printf(”\n");
}
return 0;
}