fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int n;
  6.  
  7. if (scanf("%d", &n) != 1 || n < 1) {
  8. printf("Input error");
  9. return 0;
  10. }
  11.  
  12. for(int i = 1; i <= n; ++i) {
  13. if (n % i == 0) {
  14. printf("%d ", i);
  15. }
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5320KB
stdin
10
stdout
1 2 5 10