Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- long long SNT(long long n){
- if(n<2){
- return 0;
- }
- int i;
- for(i = 2; i<=sqrt(n); i++){
- if(n%i==0){
- return 0;
- }
- }
- return 1;
- }
- using namespace std;
- int main() {
- long long a,b,i;
- cin >> a;
- cin >> b;
- if(a<=b){
- for(i = a; i<=b; i++){
- if(SNT(i)==1){
- cout << i << " ";
- }
- }
- }else{
- for(i = b; i<=a; i++){
- if(SNT(i)==1){
- cout << i << " ";
- }
- }
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement