Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. # include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,d;
  6. cout<<"Enter a natural number";
  7. cin>>n;
  8. d=1;
  9. cout<<d<<",";
  10. do
  11. {
  12. d++;
  13. if (n%d==0)
  14. cout<<d<<",";
  15. }
  16. while (d<=n/2);
  17. cout<<n;
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement