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