ToniDev

Prod. divizorilor lui n

Dec 20th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream> //input - output
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n, produs = 1;
  7.  
  8.     cout << "introdu n: "; cin >> n;
  9.  
  10.     for (int i = 1; i < n; i++)
  11.     {
  12.         if (n % i == 0)
  13.         {
  14.             produs = produs * i;
  15.             //cout << i << endl;
  16.         }
  17.     }
  18.  
  19.     cout << "Produsul divizorilor: " << produs;
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment