answersLogoWhite

0

yes. /* trapezoid.c */ #include #include float f(float); float a; float b; float x; float h; float sum; int n; int i; int main() { printf("Enter value for a: "); scanf("%f", &a); printf("Enter value for b: "); scanf("%f", &b); printf("Enter number of rectangles: "); scanf("%d", &n); h = (b - a) / n; sum = (0.5 * h) * (f(a) + f(b)); printf("%f\n", sum); for (i = 1; i < n; i++) { sum = sum + h * f(a + (i * h)); printf("%f\n", sum); } printf("The value of the integral is: %f\n", sum); } float f(float x) { float value; /* define function here */ value = x*x + 3; return value; }

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Write Client and server program in C language using UDP?

Write and run a client and a server program in C-language using UDP


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


Write an assembly language program to print a to z on screen?

write a program to print A to Z on screen in c?


Can you write program by c language in dos?

Yes.


What is nature language?

A program that understand what a human would write and be able to transform that into instructions that a computer could understand.


What is natural language interpreter?

A program that understand what a human would write and be able to transform that into instructions that a computer could understand.


Example of Password program code in assembly language?

How to write the program un Assembly language to set a password for personal computers?


Assembly language program for string concatenation using 8086 microprocessor?

write program to concatenating two sting in 8086 assembly language


How can program for c language?

first think of the logic and then write the statements


Write down a program for hotel management in c language?

ponka


How do you write an Algorithm for a C plus plus Program?

You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.


Write a program in 8086 assembly language to draw a circle?

You need an 8086 assembly language pencil.