#include
#include
void main()
{
int fact(int n);
clrscr();
printf("%d",fact(5));
getch();
}
int fact(int n)
{
int fact=1;
while(n>=1)
{
fact=fact*n;
n--;
}
return fact;
}
The factorial function is the product of a single scalar value and all of its smaller values down to one. As such, it does not make sense to ask how to find the factorial of an array. Certainly, one could determine the factorial of each element of the array; simply setup a loop that iterates through the array and then performs the factorial function.
Pseudo code+factorial
Basically, &array[i]; That is, the memory location for an array object with index i. Or, you can do: (array + i);
18 factorial is 6,402,373,705,728,000.
Divide the array in half and get the median of each half
(array.length - 1) will find the index of the last element in an array (or -1 if the array is empty).
Pseudo code+factorial
Kat
If you have N things and want to find the number of combinations of R things at a time then the formula is [(Factorial N)] / [(Factorial R) x (Factorial {N-R})]
this is a code for calculating it recursivelly: float Factorial (float n) { if (n<=1) return 1.0; else return n* Factorial(n-1); }
factorial
Basically, &array[i]; That is, the memory location for an array object with index i. Or, you can do: (array + i);
by using index position we can find the particular element in array.
The value of 9 factorial plus 6 factorial is 363,600
to find factorials you just multiply the factorial like this. for example 6! you would do 6x5x4x3x2. a little trick of mine is to multiply the previous factorial's answer by the factorial you are trying to make's number like this 6!=5! 5!=5x4x3x2 i hope this was helpful' Dayna,a 10 year old girl
It is 4060.
factorial of -1
Factorial is calculated by multiplying be each lower integer. eg factorial 4 (also written as 4!) is 4 x 3 x 2