49 lines
No EOL
916 B
C
49 lines
No EOL
916 B
C
// gcc es1.c -Wall -pedantic -std=c17 -lm -o es1
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
float fattoriale(int n) {
|
|
int kappa = 1;
|
|
for(int i = 1; i <= n; i++) {
|
|
kappa = i * kappa;
|
|
}
|
|
return kappa;
|
|
}
|
|
|
|
// N
|
|
// g_N(x) = SUM ( X^n / n! )
|
|
// n=0
|
|
double Gx(int N, double x) {
|
|
|
|
double r = 0.0;
|
|
|
|
for(int i = 0; i < N; i++) {
|
|
r = r + (pow(x, N) / fattoriale(N));
|
|
}
|
|
|
|
// printf("%f", tmp);
|
|
return r;
|
|
}
|
|
|
|
// F(x) = e^(x)
|
|
double Fx(int x) {
|
|
return exp(x);
|
|
}
|
|
|
|
int main(void) {
|
|
|
|
//printf("La costante di Nepero e: %f\n", M_E);
|
|
printf("e elevato alla seconda: %f\n", exp(1)); // e^2
|
|
int MEOW = 50; // no idea del perché non funga
|
|
puts("Start Program!!\n");
|
|
|
|
int vechi[50] = {0};
|
|
|
|
for(int i = 0; i < MEOW; i++) {
|
|
}
|
|
|
|
printf("%lf\n", Gx(10, 7));
|
|
|
|
return EXIT_SUCCESS;
|
|
} |