#include <stdio.h>
#include <stdlib.h>
int fact(int);
int main()
{
    int n,total=1,i;
    printf("enter the series limit: ");
    scanf("%d",&n);
    total=total+n;
    for(i=2;i<=n;i+=2)
    {
        total=total+(pow(n,i)\fact(i));
    }
    printf("%d",total);
    return 0;


}
int fact(int c)
{
    int j=1;
    int facto=1;
    for(j=1;j<=c;j++)
    {
        facto=facto*j;
    }
    return facto;
}

my output should be like this
1+n+nn\2!+nnnn\4!
the error says at line 12:syntax before fact

Recommended Answers

total=total+(pow(n,i)\fact(i));

Take a closer look at this equation. Specifically the math symbols.

Jump to Post

All 3 Replies

total=total+(pow(n,i)\fact(i));

Take a closer look at this equation. Specifically the math symbols.

What WaltP said. The division symbol you are using in the computation for "total" is wrong... :-)

commented: Thank you for wasting my post and not allowing him a chance to use his brain. -3

You also need to

#include <math.h>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.