Answer Posted / dharmendra nonia
using System;
class Factorial
{
public static void accept()
{
double a;
Console.WriteLine("Enter ur Number:");
a=Double.Parse(Console.ReadLine());
double res=fac(a);
Console.WriteLine(res);
}
public static double fac(double d)
{
if (d == 1)
return 1;
else
return d * fac(d - 1);
}
public static void Main()
{
accept();
Console.Read();
}
}
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
How do we achieve encapsulation in c#?
What are the types in c#?
Is there an equivalent of exit() for quitting a c# .net application?
Why do we need constructors?
What is a class c#?
What is the delegates in c#?
What are static and dynamic variables?
Explain the security with aop?
What is cshtml extension?
Explain the difference between pass by value and pass by reference.
What are the advantages of using delegates in c#?
Hi Friends, I am going through Siemens Interview Procedure from last 1+1/2 months. I went through 1 written + 2 Technical + 1 Managerial Round process after which I got call from HR informing that "you are selected and we would like to meet you for HR round". HR round was very nominal compared to MR. HR Round last for hardly 5 mins. They told me that you will get the final result on Friday. Still I have not received any feedback from them. Please help!!!
What is the difference between static class and singleton class in c#?
Why is it called c sharp?
What are the different approaches of passing parameters to a method?