This commit is contained in:
PanSi21 2025-03-05 11:12:06 +01:00
parent 8a9418f513
commit f7a282108c
Signed by untrusted user who does not match committer: PanSi21
GPG key ID: 755F8874C65EF462
3 changed files with 50 additions and 0 deletions

49
Lezione1/es1/es1.c Normal file
View file

@ -0,0 +1,49 @@
// 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;
}