The factorial sum between 0-1 and n for function calls in C Language
// Function Method
/*
========================================================== ============================
Question: Please 1 ~ The factorial of n and! (0 <= n <= 25)
========================================================== ============================
*/
# Include
# Define M 25
# Define H printf (---------------------------);
Int J (int n)
{
Int t = 1, I;
For (I = 1; I <= n; I ++)
T * = I;
Return (t );
}
Main ()
{
Int I, n, sum = 0, flag = 1;
While (flag)
{
Printf (input the maximum number of factorial and to be calculated (0 Scanf (% d, & n );
If (n 0 ))
Flag = 0;
}
For (I = 1; I <= n; I ++)
Sum + = J (I );
H; printf (1! + 2! +... + % D! = % D, n, sum); H
}
/*
========================================================== ============================
Comment: First, write a function to find the factorial of a number, then input a number to determine the sum range, and then call
Function and sum. Use a flag to ensure that the input value is available.
========================================================== ============================
*/