Home > Back-end >  Have a great god can help me with the c language to write out ah, thank you
Have a great god can help me with the c language to write out ah, thank you

Time:10-31

CodePudding user response:

#include
#include
Int the Factorial (int n)
{
If (n<0)
{
return -1;//the Error
}
If (n==0)
{
Return 1;
}
Elese
{
Return n * Factorial (n - 1);
}

}

Float SeriesSum (int n)
{
Float sum=0.0;
Int Sign=1;
for(int i=1; i<=n; I++)
{
The sum +=Sign * Factorial (I);
Sign *=1;
}
return sum;
}
Void main (void)
{
Int m=10;
Printf (SeriesSum (10));
}

CodePudding user response:

The sum +=Sign * Factorial (I);//this line of code is wrong, modify the following
The sum +=Sign/Factorial (I);//the code above is wrong
Handwritten casually, without debugging

CodePudding user response:

Reply will be integral with?
  • Related