I am facing some problems sloving this problem...

that means user inputs an number i then the program will calculate 2^i*i! and add the previous i values...Code:sum (2^i * i! )

This should be like this

Code:2^1* 1! + 2^2*2! + 2^3*3! +........+2^n*n!

i am almost solve to the third steps that is calculating ( 2^i * i ! )

but in the last step i cannot add the previous values..i know what to do to get the result that i will need a variable x initialised to 0(zero) and which will increase until it is equal toi.

that is

But i donot know where to put this and i donot know how to make a fuction with this loop..please help me out..i am pasting my existing code that is calculating up to (2^i * i! )Code:for (x=0;x <= i; i++) { x+= (previous value); }

Code:#include <stdio.h> #include <conio.h> int factorial(int i); int power( int base, int exp ); main() { int n,i,b=2,s=0,multiply; scanf("%d", &i); for (n=1;n<=i;n++) { s=((int) factorial(n)); } multiply = s*power( b, i ); printf ("The Factorial of %d is\t : %d\n2 to The Power of %d is\t : %d\n(Factorial x Exponent) is : %d\n",i, s,i, power( b, i ), multiply); getch(); } int factorial(int i) { if (i<=1) return(1); else i=i*factorial(i-1); return i; } int power( int base, int exp ) { int i, p = 1; for( i = 1; i <= exp; i++ ) { p *= base; } return p; }