A positive integer is entered through the keyboard. Write a function to obtain the prime factors of this number .for example:  Prime factors of 24 are 2,2,2 and 3 and whereas prime factors of 35 are 5 and 7.

source file name: PrimeFactors.C


void primefactor(int n)

{

int d;

d=2;

while(d<=n)

{

if(n%d==0)

{

printf(" %d",d);

n=n/d;

}

else

d++;

}

}

 void main()

 {

int n;

clrscr();

printf("\n enter any no: ");

scanf("%d",&n);

primefactor(n);

getch();

 }

output: