I'm trying to make a program to calculate sum of n terms of the series (x + (x^3)/3! + (x^5)/5! +...) -
#include<stdio.h>
#include<math.h>
main()
{
int x,r,n,fct=1;
float term,sum=0;
printf("Enter the value for x:");
scanf("%d",&x);
printf("Enter the number of terms to calculate sum upto:");
scanf("%d",&n);
for(r=2(n-1)+1;r%2!=0;r++,n++) /*as r's value in nth term comes up to be 2(n-1)+1*/
{
fct=fct*r;
term=pow(x,r)/fct;
sum=sum+term;
}
printf("The sum of the series (x^r)/r is %f",sum);
}
but it is showing the error "called object is not a function or a function pointer".
What is it and how to fix it?