c program to find prime factors of a number

#include<stdio.h>
int prime_number(int num);
int main()
{
int num;
printf(“n Enter a number for prime factor”);
scanf(“%d”,&num);
prime_number(num);
}
int prime_number(int num)
{
int i=2;
while(num!=1)
{
if(num%i==0)
{
while(num%i==0)
{
printf(“%dt”,i);
num=num/i;
}
}
i++;
}
}

OUT:
 Enter a number for prime factor420
2 2 3 5 7

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat