what's wrong with this code .
here v= any input value.
if i input 24 as 'v' then i should get 2,2,3,2 as output, but i am getting 2,3,4 as output.
both above are factors of 24 but the one i am getting is not prime factors.
here v= any input value.
if i input 24 as 'v' then i should get 2,2,3,2 as output, but i am getting 2,3,4 as output.
both above are factors of 24 but the one i am getting is not prime factors.
void factor (int v)
{
int i;
for (i=2;i<=v;i++)
{
if (v%i==0)
{
printf("\n%d",i);
v=v/i;
i=2;
}
}