Hey i was trying to write a program that accepts an user input and displays all the prime factors of that number. But i can'nt get my program working can someone please point out where the mistake is or give me hints i would be highly obliged if anyone does.
#include <stdio.h>
#include <math.h>
int primefactor(int a);
int main()
{
int a;
printf("Please enter a number: ");
scanf("%d",&a);
primefactor (a);
return 0;
}
int primefactor(int a)
{
int b,i;
int prime= 2&&5&&7&&11&&13&&17&&19&&23&&29&&31;
for(i=1; i<=100; i++)
{
b=a/i;
//printf(" %lf \n",b);
if(a%i==0)
{
//printf("Display the factors %d %t %t %t %d\n",b,i);
}
}
if(a%i==prime)
{
printf("display the prime factors %d \n",b);
}
return 0;
}