Your Ad Here

Sunday, September 26, 2010

PRINT PRIME NUMBERS BETWEEN 1-100 USING BREAK AND CONTINUE IN C

/* Prime Number between 1-100 using Break and continue statement */

#include
#include
main()
{
int i, j;
i = 1;
while ( i < 100 ) { j = 2; while ( j < sqrt(i) ) { if ( i % j == 0 ) break; else { ++j; continue; } } if ( j > sqrt(i) )
printf("%d\t", i);
++i;
}
return 0;
}

No comments:

Post a Comment

Your Ad Here