Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write code for Factorial?

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


Please Help Members By Posting Answers For Below Questions

Explain the various types of classes used in c#?

882


How do you determine whether a string represents a numeric value?

871


Explain use of abstract and sealed classes in c#?

797


What is xml serializer?

852


Define a manifest in .net?

952


What is serialization of data?

942


Why do we need singleton class in c#?

897


Are arrays value types or reference types?

895


Can abstract class be instantiated c#?

887


What is the use of ispostback in c#?

820


How can I get the ascii code for a character in c#?

1000


What is javascriptserializer c#?

930


What is overriding in c#?

831


Can a class be protected in c#?

848


Why do we need static in c#?

897