0
c# doubts
namespace SoloLearn { class Program { static int Fact(int num) { if (num == 1) { return 1; } return num * Fact(num - 1); } static void Main(string[] args) { int n= Convert.ToInt32(Console.Read()); Console.WriteLine(Fact(n)); } } } when i enter any number as input.. it always returning the output as 0....why this happening??? HELP MEEEEEE
1 Resposta
+ 1
There is something wrong with your input line.
int n = Convert.ToInt32(Console.ReadLine());
This one works.