factorial of a large number

How to get factorial of a number larger than 100?

@sumit_suthar:

this link might be of help to you :slight_smile:

Use BigInteger in java. That is the easiest way.

1 Like

BigInteger is one possible solution

my name is amardeep and i am just 13 but this is the simpliest way to calculate factorial … by using for loop

#include <stdio.h>

int main()
{
int c, n, fact = 1;

printf(“Enter a number to calculate it’s factorial\n”);
scanf("%d", &n);

for (c = 1; c <= n; c++)
fact = fact * c; // fact intial value is 1 so when the loop starts it keeps on multplying fact *c until the condition becomes false… it also changes the value of c variable

printf(“Factorial of %d = %d\n”, n, fact);

return 0;
}

my name is amardeep and i am just 13 but this is the simpliest way to calculate factorial … by using for loop

#include <stdio.h>

int main()
{
int c, n, fact = 1;

printf(“Enter a number to calculate it’s factorial\n”);
scanf("%d", &n);

for (c = 1; c <= n; c++)
fact = fact * c; // fact intial value is 1 so when the loop starts it keeps on multplying fact *c until the condition becomes false… it also changes the value of c variable

printf(“Factorial of %d = %d\n”, n, fact);

return 0;
}

Excuse me brother, since you code in C++ 4.3.2 have look at this : http://ideone.com/Q6PiJB

1 Like