C Program to print all prime numbers btw 1 to 100..
pls explain the program: What is if(p)??
Code
#include
#include
int main()
{
int num,n,div,p;
printf("Enter any number: ");
scanf("%d", &num);
for(n=2; n<=num; n++)
{
for(div=2; div {
if(n%div==0)
{
p=0;
break;
}
p=1;
}
if(p)
printf(" %d",n);
}
getch();
}
Copyright GeekInterview.com
Program to print all prime numbers btw 1 to 100
pls explain the program: What is if(p)??
Questions by Pavani Shiny
Related Answered Questions
Related Open Questions