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

What are c# i/o classes?

1069


In which way you can convert a value-type to a reference-type?

1021


What is anonymous types in c#?

977


What is difference between hashtable and dictionary in c#?

1000


Why is c# a good programming language?

1056


Is c# difficult to learn?

909


Does c# have primitives?

928


Explain the constructor in c#.

1152


What is an int c#?

914


What is gac? What are the steps to create an assembly and add it to the gac?

976


Why constructor is used in c#?

953


State two different types of access modifiers.

1067


what is the difference between interface and multiple interface?

1162


Does c# support parameterized properties?

1001


What is the Signification of the "new " keyword in C#? example

993