Advertisement

Write a program to find the prime factors of a number.


           #include <stdio.h>
         #include <conio.h>

         void main()
         {
            printf(“Enter the number: ”)
            scanf(“%d”,&num);
            int num,i;
                  for(i=2;i<=num;++i)
                     {
                         if(num%i= = 0)
                              {printf(“%d”,i);
                                    num=num / i;
                                    - -i;
                              }
                            }
                 getch();  }  

No comments:

Post a Comment

Please comment bellow. Share your knowledge