- #1
ming2194
- 32
- 0
Homework Statement
http://u1.imgupload.co.uk/1257465600/6baa_prime1.jpg
how can i write a C programe that can give a output exactly the same as the pic above?
Homework Equations
above.
The Attempt at a Solution
PHP:
printf("The prime numbers less than or equal to %d are:\n", number);
int pos = 0;
int pcount = 0;
while(primes[pos] != -1)
{
if(primes[pos] != -2)
{
printf("\t%d\n", primes[pos]);
pcount++;
}
pos++;
}
printf("The total count of prime numbers is: %d\n", pcount);
I have tried my best to attempt the required programe and it is shown above.
but when i try to run it in codeblock it shows nothing.
is there any critia code i missed or some fautal error in my attempt?
thx for help.