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