Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Euler\'s Number (e the base for natural logarithms) is defined as Write a progra

ID: 2291567 • Letter: E

Question

Euler's Number (e the base for natural logarithms) is defined as Write a program which will calculate and print the value of e (the natural logarithm ase, 2.718...). Each subsequent term (for no1) may be calculated by dividing the previous term by n. For example if the value of term 2 (1/(2) 0.5), then we can calculate the value of term 3 by dividing term 2 by 3 (0.5/3) As each term is calculated, it must be added to a running sum. Determine the value of e by summing the first 100 terms in the series. Output: Iculations; specifically for each value of n, output n, the value of the term, and the value of the sum. The sample output below ONLY shows the output for the first 10 terms. Your program must calculate and output 100 terms (with running sum), perform a calculations to at least 200 digits of precision, and print all values with 72 decimal places of precision. ll TRM-1.00000000000 SUM-1.000000000 oo00000000o00000000000000000000000000000o00000000000000000000 0000000000000000000o0000000000000000000000000000000000000000000 TRM-1.000o00000000oo00000oo00000000000000000000000000000000000000000000 SUM-2.00000000000000000000000000000000000000000000000 N 2 s000000000000000000o000000000000000000000000000000000000o0 SUM-2.50o0000000000000000000000000000000000000000000000000000000000 TRM-0.1666666666666666666666666666666666666 SUM-2.666666666666666666666666 Na 4 041666666666666666666666666666666666666666666666666666666666666666666666 SUM-2.70833333333333333333333333333333333333333333333333333333333333333333 0.008333333333333333333333333333333333333333333333333333333333333333333333 716666666666666666666666666666666666666666666666666666666666666666666666 SUM-2. TRM-0.001388888888888888888888888888888888888888888888888888888888888888888888 SUM-2.718055555555555555555555555555555555555555555555555555555555555555555555 TH·0.0001984126984126984 126 984126984126984 12 6984126984126984 12698412698412698 SUM-2.718253968253968253968253968253968253968253968253968253968253968253968253 TRM 0.000024801587301587301587301587301587301587301587301587301587301587301587 SUM-2.718278769841269841269841269841269841269841269841269841269841269841269841 TRM-0.000002755731922398589065255731922398589065255731922398589065255731922398 SUM-2.718281525573192239858906525573192239858906525573192239858906525573192239 N= 10- TRM-0.000000275573192239858906525573192239858906525573192239858906525573192239 SUM-2. 718281801146384479717813051146384479717813051146384479717813051146384479 Remember your program must calculate 200 digits of precision, print values with 72 decimal places of precision, and calculate/sum the first 100 terms

Explanation / Answer

#include <stdio.h>
void longdivision(int num[],int div){
int i;
int x=0;
for(i=0;i<200;i++){
x=(x%div)*10+num[i];
num[i]=x/div;
}
}
void add(int num1[],int num2[]){
int i;
for(i=200;i>0;i--){
num1[i-1]+=(num1[i]+num2[i-1])/10;
num1[i]=(num1[i]+num2[i-1])%10;
}
}
int main(){
int num[200]={0};
int i;
printf("N= 0 ");
printf("Term=1.");
for(i=0;i<200;i++) printf("0");
printf(" ");
printf("Sum=1.");
for(i=0;i<200;i++) printf("0");
printf(" ");

printf("N= 1 ");
printf("Term=1.");
for(i=0;i<200;i++) printf("0");
printf(" ");
printf("Sum=2.");
for(i=0;i<200;i++) printf("0");
printf(" ");

num[0]=5;
printf("N= 2 ");
printf("Term=0.");
for(i=0;i<200;i++) printf("%d",num[i]);
printf(" ");
printf("Sum=2.");
for(i=0;i<200;i++) printf("%d",num[i]);
printf(" ");
int sum[201]={0};
sum[0]=2,sum[1]=5;
for(i=3;i<11;i++){
longdivision(num,i);
add(sum,num);
int j;
printf("N= %d ",i);
printf("Term=0.");
for(j=0;j<200;j++) printf("%d",num[j]);
printf(" ");
printf("Sum=%d.",sum[0]);
for(j=1;j<=200;j++) printf("%d",sum[j]);
printf(" ");
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote