I need a Help Solving this problem...Listen i Am at the very beginner level. Som Pls forgive my mistakes..
1 2 3 4 5
sum(2^i.i!)
it should be like this: 2^1! + 2^2.2! + 2^3.3! + ........+ 2^n.n!
.. I am almost solved..but cannot make the last function that will add all those values upto my input..i am pasting my code..pls let me help findind the last step and explain
#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;
long int x;
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\nThe Sum of multiplication is : %d ",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;
}