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:
The program should accept as input:
(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.
#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;
}
}
Comments
Leave a comment