I have assumed N to be hundred. You can use scanf to input N and display

**prime number between 1 to n.**

###
**Prime Numbers are numbers which are only divisible by two numbers. eg 2,3,5,7,11 etc.**

## c program for prime number

int main()

{

int i,j,n=0;

for(i=2;i<=100;i++)

{

for(j=1;j<=i;j++)

{

if(i%j==0)

{

n++;

}

}

if(n==2)

printf("%d\n",i);

n=0;

}

getch();

}

## { 4 comments ... read them below or add one }

very nice,

easy to understand

excellent bro....u r great

i like the idea, but there is a bug. You have to set n = 0 in an else branch as well because otherwise it doesn't reset for each i.

@above

n=0 is not part of if block since there are no {} and therefore we don't need else block

## Post a Comment