fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int n;
  8. cin>>n;
  9.  
  10. if(n<=0){
  11. cout<<-1<<endl;
  12. }
  13.  
  14. for(int i=1; i<=n; i++){
  15. if(n%i == 0){
  16. cout<<i<<endl;
  17. }
  18. }
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5288KB
stdin
12
stdout
1
2
3
4
6
12