Tuesday, September 8, 2009

Print prime numbers between 1-300 using break and continue in c




Print
prime numbers between 1-300 using break and continue in c



#include

#include

main(){

int i, j;

i = 2;

while ( i < 300 ){

j = 2;

while ( j < sqrt(i) ){

if ( i % j == 0 )

break;

else{

++j;

continue;

}

}

if ( j > sqrt(i) )

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

++i;

No comments:

Post a Comment