/*To expand (1+x)^m series*/
#include<stdio.h>
#include<math.h>
int main()
{
float sum, term, x;
int n, i, m;
printf("Enter the values of x & No. of countable terms(n):\n");
scanf("%f %d", &x, &n);
printf("Enter the power(m):");
scanf("%d", &m);
sum=1+m*x;
term=m*x;
for(i=1;i<=(n-1);i++)
{
term =term*x*(m-i)/(i+1);
sum=sum+term;
}
printf("\n(1+(%f))^%d=%f \n", x, m, sum);
return(0);
}
#include<stdio.h>
#include<math.h>
int main()
{
float sum, term, x;
int n, i, m;
printf("Enter the values of x & No. of countable terms(n):\n");
scanf("%f %d", &x, &n);
printf("Enter the power(m):");
scanf("%d", &m);
sum=1+m*x;
term=m*x;
for(i=1;i<=(n-1);i++)
{
term =term*x*(m-i)/(i+1);
sum=sum+term;
}
printf("\n(1+(%f))^%d=%f \n", x, m, sum);
return(0);
}
Comments
Post a Comment