fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int main()
  5. {
  6. printf("Nhap so n: ");
  7. int n;
  8. scanf("%d", &n);
  9. int i=2;
  10. while(i<=n)
  11. {
  12. if(n % i == 0)
  13. {
  14. n /= i;
  15. printf("%d\n", i);
  16. }
  17. else i++;
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 9424KB
stdin
25
stdout
Nhap so n: 5
5