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