Html codes
184 subscribers
112 photos
15 videos
226 files
198 links
👋 Welcome to Html Codee
🚀 Here you’ll find mini tools, code snippets, and web tricks to grow fast.
🧩 Built with HTML, PHP, and smart ideas.
💌 Support: support@bestpage.x10.mx
🏁 If you don't walk today, run tomorrow.
Download Telegram
#include <stdio.h>
#include <math.h>

#define N 1000000
#define PI 3.141592653589793


double f1(double x) {
return 5.0 * (1 - cos(2 * x));
}


double f2(double x) {
return 5.0 * pow(log(x + 1), 2) / (x + 1);
}

double f3(double x) {
return exp(PI - x) / sqrt(x * x + 1);
}

double simpsons_rule(double (*func)(double), double a, double b, int n) {
if (n % 2 != 0) {
printf("Error: N must be even.\n");
return -1;
}

double h = (b - a) / n;
double sum = func(a) + func(b);

for (int i = 1; i < n; i += 2) {
double x = a + i * h;
sum += 4.0 * func(x);
}
for (int i = 2; i < n; i += 2) {
double x = a + i * h;
sum += 2.0 * func(x);
}

return (h / 3.0) * sum;
}

int main() {
double integral1 = 5.0 * PI / 2.0;
double integral2 = simpsons_rule(f2, 0, PI, N);
double integral3 = simpsons_rule(f3, 0, PI, N);
double result = integral1 - integral2 + integral3;
printf("Integral 1 : %.10f\n", integral1);
printf("Integral 2 : %.10f\n", integral2);
printf("Integral 3 : %.10f\n", integral3);
printf("By solving all equation:( %.10f-%.10f+%.10f)\n", integral1,integral2,integral3);
printf("your age is approximately : %.10f\n", result);

return 0;
}