Question: What is wrong with my C code. It is suppose to generate a table of prime number, but it is not compiling. #include #include int

What is wrong with my C code. It is suppose to generate a table of prime number, but it is not compiling.

#include

#include

int main (void)

{

int p;

int d;

bool isPrime;

if (p % 2 != 0)

{

isPrime = true;

for ( p = 2; p <= 50; p++)

{

isPrime = 1;

for ( d = 2; (isPrime != false) && (d < p); d++)

{

if ( p % d ==0)

isPrime = false;

}

if ( isPrime != false)

printf("%i ", p);

}

}

printf(" ");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!