WAP to print the series 2!+3!+...n!

0 jenson francis · February 27, 2015
urgent help

Post a Reply

Replies

Oldest  Newest  Rating
0 Filip Petrovic · February 28, 2015
Hope this helps
UPDATE: sorry, for some reason, it didn't show full code and i didn't see that...it's fixed now.

    int f,      //          how many factorials
        n,      //          each factorial
        s = 0,  //          sum of factorials
        i,      //          first counter
        i2;     //          second counter
    printf("How many factorials?\n");
    scanf("%d", &f);


    for(i=1; i<=f; i++) {   // if you want to start from 2, then change counter to 2   =>  i=2

        n = 1;

        for(i2=1; i2<=i; i2++) {
            if(i2<=i){
                n *= i2;
            }
        }

        s = s + n;

    }

    printf("\n\n\n%d\n", s);
0 jenson francis · March 4, 2015
THANK U SO MUCH IT DID HELP
  • 1

C++

107,007 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator