Hi guys I have some problem regarding getting prime factors and distinct prime factors.
I manged to get the prime factors but I got stuck on how to get the distinct prime factors.........I don't know how to select unique prime factors and print them....Help me out guys........
Thank you in advance....
My code to get just the prime numbers is............
#include<stdio.h>
#include<conio.h>
int main()
{
int n,i;
printf("Enter a Number:");
scanf("%d",&n);
printf("\n\nPrime Factors of %d is: ",n);
for(i=2;i<=n;i++)
{
if(n%i==0)
{
printf("%d,",i);
n=n/i;
i--;
if(n==1)
break;
}
}
getche();
}