I am trying to use the sum ∑ from i=0 to N of x^(2i+1)/(2i+1)! which is the sum of the series of sinh. now i am able to get the top part of the series but the buttom part i am having issues

basically this is the part that i have issues with :

Code:

for(i = 1;i <= N+1; i = i + 2){
for(j=1 ; j <= i; j++)
{
f= f * j;
}
sum = sum + pow(x,i)/f;
}
return sum;
}

mainly the 2nd "for".

and yes I know that c can compute sinh however my homework says that i have to do this so here we are.

Code:

#include <stdio.h>#include <stdlib.h>
#include <math.h>
#define TRUE 1
#define FALSE 0
void getInput(double *N, double *x);
double sinHyper(double N , double x);
int main()
{
double sum;
double N;
double x;
char ans;
int flag;
do
{
flag = TRUE;
getInput(&N,&x);
sum = sinHyper(N,x);
printf("\nsum : %g\n\n\n", sum);
printf("Do you wish to quit (y/n)? ");
fflush(stdin);
scanf("%c",&ans);
if( ans != 'n')
{
printf("Program terminated \n");
flag = FALSE;
}
} while(flag == TRUE);
}
void getInput(double *N, double *x)
{
int flag;// Declaration of variable
double N1, x1;
do
{
flag = TRUE;
printf("Please enter the number of terms N : ");
scanf("%lf",&N1);
printf("Please enter the value x : ");
scanf("%lf",&x1);
if( N1 < 0.0)
{
printf("the value of N must be greater than zero.\n");
flag = FALSE;
}
*N = N1;
*x = x1;
} while(flag == FALSE);// Get input from user
}
double sinHyper(double N , double x)
{
double i , j;
double sum = 0;
double f = 1;
double k = 1;
for(i = 1;i <= N+1; i = i + 2)
{
for(j=1 ; j <= i; j++)
{
f= f * j;
}
sum = sum + pow(x,i)/f;
}
return sum;
}