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