fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int numb,count1,i,j,count2;
  5. printf("Please enter the number who's prime factors and their count is to be determined\n");
  6. scanf("%d",&numb);
  7.  
  8. count1=0;
  9.  
  10.  
  11. printf("\nThe prime factors are\n");
  12. for(i=2;i<numb;i++)
  13. {
  14.  
  15. count2=0;
  16. j=2;
  17.  
  18. while(((numb%i)==0)&&(j<i))
  19. {
  20. if((i%j)==0)
  21. {
  22. count2++;
  23.  
  24. }
  25.  
  26. j++;
  27. }
  28.  
  29.  
  30. if((count2==0)&&((numb%i)==0))
  31. {
  32. count1++;
  33. printf("%d\n",i);
  34. }
  35. }
  36. if(count1==0)
  37. {
  38. printf("None\n");
  39. }
  40.  
  41. printf("So there are %d Prime factors\n", count1);
  42.  
  43. }
Success #stdin #stdout 0s 2116KB
stdin
9
stdout
Please enter the number who's prime factors and their count is to be determined

The prime factors are
3
So there are 1 Prime factors