Advertisement
MeehoweCK

Untitled

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