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