#include<stdio.h>
int main()
{
int num;
printf("ENTER THE NUMBER FOR PRIME FACTORS : ");scanf("%d",&num);
prime(num);
}
void prime(int n)
{
int i;
for(i=2;i<=n;i++)
{
if(n%i==0)
{
printf("%d,",i);
return prime(n/i);
}
}
}
int main()
{
int num;
printf("ENTER THE NUMBER FOR PRIME FACTORS : ");scanf("%d",&num);
prime(num);
}
void prime(int n)
{
int i;
for(i=2;i<=n;i++)
{
if(n%i==0)
{
printf("%d,",i);
return prime(n/i);
}
}
}
No comments:
Post a Comment