Answer Posted / rajender
private void btnCalculae_Click(object sender,
System.EventArgs e)
{
long number = Convert.ToInt64 (txtNumber.Text);
long factorial = 1;
lblFactorial.Text = factorial.ToString
("n20");
// calculate factorial
while ( number > 0 && number <= 20)
{
factorial *= number;
number++;
} // end while loop
txtNumber.Text = "";
txtNumber.Focus();
}
private void btnExit_Click(object sender,
System.EventArgs e)
{
this.Close();
}
}
}
Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
What is a byte in c#?
Why is main static in c#?
What is the property of class?
Why do we parse in c#?
What is the difference between structure and class in c#?
Explain the difference between passing parameters by value and passing parameters by reference with an example?
How to reverse each word in a string using c#?
Can we override main method in c#?
You have got 1 million parking slots. At a time a parking slot can be free or not. To get next slot easily which data structure to implement?
What is difference between int and int in c#?
How many constructor can a class have?
What is the use of regex in c#?
What is tochararray in c#?
Which function is the entry point for a DLL in MS Windows 3.1?
What is lazy loading and eager loading in c#?