Answer to Question #239301 in C++ for HelloWorld

Question #239301

Write a program that computes the value of the expression: lim(x->inf)(1+1/n)n

between certain values of n and then compare the values with e.

For example, you can compute the values of the expression between:

  • 100 and 10,000 with an increment of 100
  • or between 1,000 and 1,000,000 with an increment of 1,000.

The program should accept as input:

  1. The start value for n
  2. The end value for n

(Note: The increment value of 100 should be hardcoded in the program upon final submission.)

The program should then output the value of the expression for each value of n in the specified range with a decimal precision of 8.


1
Expert's answer
2021-09-19T17:11:52-0400


#include<conio.h>
#include <iostream>
# include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include <cmath>
#include<dos.h>
#include <bits/stdc++.h> 
using namespace std;




//Write a program that computes the value of the expression: lim(x->inf)(1+1/n)n


int main()
{
	double n,y,i,Step,End,Start;
	
	cout<<"\n\tEnter Start Value of n : "; cin>>Start;
	cout<<"\n\tEnter End   Value of n : "; cin>>End;
	Step=Start;
	
	y=0;
	for(n=Start;n<=End;n=n+Step)
	{	
		y = pow((1 + (1/n)),n);
		cout<<"\n\tn = "<<setw(8)<<n<<setprecision(8)<<"\t\ty = "<<y;
	}
}









Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS