Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- void print(int x) {
- if(x > 100) {
- return;
- }
- bool prost = true;
- for(int i = 2; i < x; i++) {
- if(x % i == 0) {
- prost = false;
- break;
- }
- }
- if(prost and x != 1) {
- cout << x << " ";
- }
- print(x + 1);
- }
- int main() {
- print(1);
- return 0;
- }
- // print(1) --> print(2) | cout << 1;
- // print(2) --> print(3) | cout << 2;
- // print(3) --> print(4) | cout << 3;
- // print(4) --> print(5) | cout << 4;
- // print(5) --> print(6) | cout << 5;
- // print(6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement