MarcinKrol

Zad16

Mar 24th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. //Zad16
  4.  
  5.  
  6. using namespace std;
  7. int n;
  8. void DZIELNIKI(int n)
  9. {
  10. for(int i=n; i>=1; i--)
  11. {
  12. if(n%i==0)
  13. {
  14. cout<<i<<endl;
  15. }
  16. }
  17. }
  18. int main()
  19. {
  20. cout << "Podaj liczbe naturalna: ";
  21. cin>> n;
  22. if(n<0)
  23. {
  24. cout<<"To nie jest liczba naturalna"<<endl;
  25. }
  26. cout<<"Dzielniki tej liczby"<<endl;
  27. DZIELNIKI(n);
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment