This code is runnig perfectly for values perfectly divisible by 2, that is 2,4,8 But the i is not incrementing when values are given such as 7,5
could u plz tell me the error
Thanks
#include<stdio.h>
#include<conio.h>
int fun(int);
int main()
{
int num;
float mod,prime,m;
printf("enter the num");
scanf("%d",&num);
fun(num);
getch();
}
int fun(int n)
{
int i=2,temp;
float div;
div=n/i;
if(n==1)
{
return(1);
}
else if(n%i==0)
{
printf("\n The prime factor of number is %d",i);
return(fun(n=div));
}
else
i++;
}