Jan 3, 2012

C Program to implement Integration.

C Program to implement Integration. Integration is the important concept of calculus, which is the inverse of the differentiation. A definite integral gives the area between the graph of a function and the horizontal axis between vertical lines at the endpoints of an interval. Integration is used to find the area, volume of irregular shapes. In the following code, We find the integration of the defined function between two boundary limits, which are entered by the user. Read more about C Programming Language .


/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* 
*                      Happy Coding
***********************************************************/

#include <stdio.h>
/* Propram to perform definite integration of a given function between
 two boundary limits input by user. Feel free to use and modify it, but
 please do not remove this comment.
 source: C for Engineering, http://c4engineering.hypermart.net */

#define N 1000

void main(void) {
 float i, a, b, sum = 0;
 printf(
   "\nThis program will integrate a function between two boundary limits.");
 printf("\n\nEnter the first boundary limit:");
 scanf("%f", &a);
 printf("\nEnter the second boundary limit:");
 scanf("%f", &b);
 if (a > b) {
  i = a;
  a = b;
  b = i;
 }

 for (i = a; i < b; i += (b - a) / N) {
  /* Define your function below, and include the suitable header files */
  y = x * x + 2 * x - 4;
  sum += y * (b - a) / N;
 }

 printf("\n\nValue of integration is:%.3f", sum);
 getch();
 return;
}

Array In C

C Data Structures

Simple C Programs
You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it


(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link