c# - Factorial task is incorrectly outputting zero -
I am having trouble in the dry part of a program, I can not find it, so my program is giving 0 in output . Here's my code:
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; Namespace Task_8_Set_III {class program {static zero main (string [] args) {int i = 3; Int c = i / fact (i); Console.light line ("is factorial:" + c); Console.ReadLine (); } Fixed int fact {if (value == 1) {return 1; } And {return (value * (fact (value - 1)); }}}}}
You are dividing the integer variables you are 3 to 6 Are divided, which gets round in the next integer, which is zero.
Instead of getting that value, instead of 'int', type 'double' which you may be looking for.
Comments
Post a Comment