adspace


"c sharp" code for factorial using static variables

Answer Posted / arup ratan banerjee

using System;
class fact
{
int factorial(int x)
{
Static int y=1;
y=y*x;
return y;
}
public static void Main()
{
fact f=new fact();
int k=Convert.ToInt32(System.ReadLine());
for(int i=1;i<=x;i++)
{
int x=f.factorial(i);
}
System.Console.WriteLine(x);
}
}

Is This Answer Correct ?    64 Yes 33 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category