This will always return 0, because the last fac will always be 0 and it multiplies all the other results. Change that to
if(a<1)
fac=1;
Also indent your code properly.
solved what is wrong with my factorial program ??? [closed]
This will always return 0, because the last fac will always be 0 and it multiplies all the other results. Change that to
if(a<1)
fac=1;
Also indent your code properly.
solved what is wrong with my factorial program ??? [closed]