The Tech Pursuit
The Dev Shelf
Pages
Home
Interview Questions
About Me
April 8, 2015
Write a program in C# to get factorial of number
static
void
Main(
string
[] args)
{
int
Number = 5;
// Need to find factorial of 5
int
Result = 1;
while
(Number > 0)
{
Result = Result * Number;
Number = Number - 1;
}
Console
.WriteLine(Result);
Console
.ReadLine();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment