Advertisement
MeehoweCK

Untitled

Jun 11th, 2021
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     unsigned n;
  8.     cout << "Podaj liczbe naturalna: ";
  9.     cin >> n;
  10.     cout << "Naturalne dzielniki liczby " << n << ":\n";
  11.     cout << 1 << '\t';
  12.  
  13.     for(unsigned dzielnik = 2; dzielnik < n; ++dzielnik)
  14.     {
  15.         if(n % dzielnik == 0)
  16.             cout << dzielnik << '\t';
  17.     }
  18.     cout << n << endl;
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement