Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n;
- void dzielniki(int n)
- {
- for(int i=n; i>=1; i--)
- {
- if(n%i==0)
- {
- cout<<i<<endl;
- }
- }
- }
- int main()
- {
- cout << "Podaj liczbe naturalna: ";
- cin>> n;
- if(n<0)
- {
- cout<<"To nie jest liczba naturalna"<<endl;
- }
- cout<<"Dzielniki tej liczby"<<endl;
- dzielniki(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement