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...
This should be like this
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 to i .
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! )
for (x=0;x <= i; i++)
x+= (previous value);
int factorial(int i);
int power( int base, int exp );
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);
int factorial(int i)
int power( int base, int exp )
int i, p = 1;
for( i = 1; i <= exp; i++ )
p *= base;