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