===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
double n=0,X=0,SUM=0,i=1,sum=1,q=1;
cout<<"\nEnter number: ";
cin>>n;
cout<<"\nEnter variable: ";
cin>>X;
cout<<"\n\n\n";
do
{
do
{
sum=i*sum;
q++;
}while(q<=i);
SUM=pow(X,i)/sum+SUM;
if(i<n)
cout<<"("<<X<<"^"<<i<<")/("<<i<<"!) + ";
else
cout<<"("<<X<<"^"<<i<<")/("<<i<<"!) = ";
i++;
}while(i<=n);
cout<<SUM;
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
double n=0,X=0,SUM=0,i=1,sum=1,q=1;
cout<<"\nEnter number: ";
cin>>n;
cout<<"\nEnter variable: ";
cin>>X;
cout<<"\n\n\n";
do
{
do
{
sum=i*sum;
q++;
}while(q<=i);
SUM=pow(X,i)/sum+SUM;
if(i<n)
cout<<"("<<X<<"^"<<i<<")/("<<i<<"!) + ";
else
cout<<"("<<X<<"^"<<i<<")/("<<i<<"!) = ";
i++;
}while(i<=n);
cout<<SUM;
getch();
}
===========================================================================
No comments:
Post a Comment