Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main ( void ) {
- int a, b;
- bool isPrime;
- scanf ( "%d%d", &a, &b );
- if ( a > b )
- printf ( "0\n" );
- else
- while ( a < b ) {
- isPrime = true;
- /// If is prime
- for ( int i = 2; i <= sqrt(a); i++ ) {
- if ( a % i == 0 ) {
- isPrime = false;
- break;
- }
- }
- if ( isPrime )
- printf ( "%d ", a );
- a ++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement