fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a,i,j,c;
  5. printf("Enter a number ");
  6. scanf("%d",&a);
  7. for(i=2;i<=a/2;i++)
  8. {
  9. if (a%i==0)
  10. {
  11. c=1;
  12. for(j=2;j<=i/2;j++)
  13. {
  14. if(i%j==0)
  15. {
  16. c=0;
  17. break;
  18. }
  19. }
  20. if(c==1)
  21. {
  22. printf("%d ",i);
  23. }
  24.  
  25. }
  26. }
  27. return 0;
  28.  
  29. }
  30.  
Success #stdin #stdout 0s 4508KB
stdin
20
stdout
Enter a number 2 5