Advertisement
skb50bd

Prime Factors

Apr 21st, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n, i;
  5.  
  6.     printf("Enter the Number: ");
  7.  
  8.     while(scanf("%d",&n)!=EOF)
  9.     {
  10.         for(i=2 ; i<=n && n>1 ;)
  11.         {
  12.             if(n%i==0)
  13.             {
  14.                 printf("%d ",i);
  15.                 n=n/i;
  16.             }
  17.             else i++;
  18.         }
  19.         printf("\nEnter the Number: ");
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement