Download
100% FREE
Office Document APIs for .NET
Online: 769
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Bookmarks
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Forums
>
C#
>
Loading ...
How can find the factorial of 100! in c#.
Posted by
Bageshkumarbagi
under
C#
on 10/10/2012 |
Points: 10
| Views : 5373 | Status :
[Member]
| Replies : 3
Write New Post
|
Search Forums
|
Resolved Posts
|
Un Answered Posts
|
Forums Home
hi,
I want to find the factorial of 100!. I am finding the problem which type of data type i take. 100! has very large value.
Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied
Reply
|
Reply with Attachment
Alert Moderator
Responses
Posted by:
Pgayath
on: 10/12/2012
[Member]
Starter
|
Points: 25
0
You can try with double
static double Factorial(double number)
{
double Result;
try
{
if (number <= 1)
Result= 1;
else
Result= number * Factorial(number - 1);
return Result;
}
catch (Exception e)
{
return 0;
}
finally
{
}
}
static int Main(string[] args)
{
Console.WriteLine("The factorial of 100 is: {0}\n",
Factorial(100));
Console.ReadLine();
return 0;
}
Copy the value and paste it in the excel and format the cell to Number. You can see the result.
Thanks and Regards,
Gayathri P
Bageshkumarbagi
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Bageshkumarbagi
on: 10/12/2012
[Member]
Starter
|
Points: 25
0
Hi , Gayathri Purushothaman
factorial of 100 is a big number .we cannot store it in double.
Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied
Bageshkumarbagi
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
K011gusain89
on: 10/29/2012
[Member]
Starter
|
Points: 25
0
static void Main(string[] args)
{
int n, i;
double f;
Console.WriteLine("Enter an integer: ");
n = Convert.ToInt32(Console.ReadLine());
f = n < 0 ? 0 : 1;
for (i = n; i >= 1; i--)
f *= i;
Console.WriteLine("Factorial = " + f);
Console.ReadLine();
}
Bageshkumarbagi
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Login to post response
Latest Posts
How to Find count Details Sql server
(0)
sharepoint installation system requirements
(0)
Web Api not working with mvc
(1)
How to get label text from table reference on database based on TableName and FieldName
(0)
How can i refresh Page after downloading a file in MVC ?
(1)
sql server dba interview questions
(1)
How to change json data while making click in AngularJs
(1)
i want call bind method after for loop and ajax call in mvc,callwaiting
(0)
More ...