NIKOLAY_TETUS

Untitled

Nov 3rd, 2021
1,215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     printf("n>");
  8.     scanf("%d", &n);
  9.    
  10.     for (int i = 1; i < sqrt(n) + 1; i++)
  11.     {
  12.         if (n % i == 0)
  13.         {
  14.             printf("%d, ", i);
  15.            
  16.             if (i * i != n)
  17.                 printf("%d, ", n / i);
  18.         }
  19.     }
  20.  
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment