Question
can you make three seperate flowchart for the function, integral, and main function? #include double function(double x) { return 5 * x * x +
can you make three seperate flowchart for the function, integral, and main function?
#include
double function(double x) { return 5 * x * x + 2 * x + 1; }
double integral(double lower_bound, double upper_bound, int intervals) { double delta_x = (upper_bound - lower_bound) / intervals; double result = 0.0; int i;
for (i = 1; i < intervals; i++) { double x = lower_bound + i * delta_x; result += function(x); }
result = (result + (function(lower_bound) + function(upper_bound)) / 2) * delta_x;
return result; }
int main() { double lower_bound, upper_bound; int intervals;
printf("Insert lower bound for the integral: "); scanf("%lf", &lower_bound);
printf("Insert upper bound for the integral: "); scanf("%lf", &upper_bound);
printf("Insert the intervals: "); scanf("%d", &intervals);
double result = integral(lower_bound, upper_bound, intervals); printf("The integral result from 5x^2 + 2x + 1 is: %lf ", result);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started