JakubJaneczek

Zadanie 16

Apr 7th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a,b,c;
  4.  
  5. void dzielniki(int n)
  6. {
  7.     int a=1;
  8.     while(a<=n)
  9.     {
  10.         if(n%a==0)
  11.         {
  12.             cout << a << ";";
  13.         }
  14.         a++;
  15.     }
  16. }
  17.  
  18. int main()
  19. {
  20.     cout << "Dzielniki 5 to" << endl;
  21.     dzielniki(5);
  22.     cout << endl;
  23.     cout << "Dzielniki 6 to" << endl;
  24.     dzielniki(6);
  25.     cout << endl;
  26.     cout << "Dzielniki 7 to" << endl;
  27.     dzielniki(7);
  28.     cout << endl;
  29.  
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment