Print? /* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)
* Copyright and version Declaration of the program
* All rights reserved.
* File name: txt. c
* Author: liuyongshui
* Question: f = 1-i/2! + 1/3! -.... + 1/9!
* Problem source:
* Completion date: January 1, April 10, 2013
* Version No.: V1.0
*/
# Include <stdio. h>
Int factorial (int num); // factorial
Int main ()
{
Int I = 1;
Double f = 0;
Int flag = 1;
Do
{
F + = flag * 1.0/factorial (I );
Flag =-1 * flag;
I ++;
} While (I <= 9 );
Printf ("the result is: % f \ n", f );
Return 0;
}
// Function Definition
Int factorial (int num) // factorial
{
Int j = 1;
Int k = 1;
Do
{
K * = j;
J ++;
} While (j <= num );
Return k;
}
/* Start the comments in the program header (to avoid any problems encountered during the submission of blog posts, the slash used to indicate that the comments have been deleted)
* Copyright and version Declaration of the program
* All rights reserved.
* File name: txt. c
* Author: liuyongshui
* Question: f = 1-i/2! + 1/3! -.... + 1/9!
* Problem source:
* Completion date: January 1, April 10, 2013
* Version No.: V1.0
*/
# Include <stdio. h>
Int factorial (int num); // factorial
Int main ()
{
Int I = 1;
Double f = 0;
Int flag = 1;
Do
{
F + = flag * 1.0/factorial (I );
Flag =-1 * flag;
I ++;
} While (I <= 9 );
Printf ("the result is: % f \ n", f );
Return 0;
}
// Function Definition
Int factorial (int num) // factorial
{
Int j = 1;
Int k = 1;
Do
{
K * = j;
J ++;
} While (j <= num );
Return k;
}