#include<stdio.h>
int main()
{
int pcheck=1,i;
int k=1000
for(i=2;i<k;i++)
{
if((k%i)== 0)
{
pcheck=0;
break;
}
}
if(pcheck)
{
printf("%d is a prime .\n",k);
}
else
{
printf("%d is not a prime.\n",k);
}
return 0;
}
this code works to check any number i that write in k but when i put a do while loop.stating that do while should loop while k!=0 then i k-- so that can check if all the number less than 1000 are prime. it prints all not prime..please guys help me