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