-
-
Save amankharwal/b712193d2ad8e38574caa6e045862b19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<math.h> | |
using namespace std; | |
bool isPrime(int num){ | |
for (int i = 2; i <= sqrt(num); i++){ | |
if (num % i == 0){ | |
return false; | |
} | |
} | |
return true; | |
} | |
int main(){ | |
int a,b; | |
cin>>a>>b; | |
for (int i = a; i <= b; i++){ | |
if (isPrime(i)){ | |
cout<<i<<endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment