自然指數
user_3763047219
c_cpp
3 years ago
367 B
4
Indexable
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>//header standard Input/ouput
#include<stdbool.h>
#include<assert.h>
int main()
{
double x = 1;
int n = 10;
float e = 1;
float xpower = 1;
int factorial = 1;
double term = 1;
for (int i = 1;i <= n;i++) {
term = term * (x/i);
e += term;
}
printf("%f\n", e);
}Editor is loading...