#include <stdio.h> #define X 1000 void main(void) { float i, p, q, total = 0; printf("\nThis program will integrate p function between two boundary limits."); printf("\n\nEnter the first boundary limit:"); scanf("%f", &p); printf("\nEnter the second boundary limit:"); scanf("%f", &q); if(p > q) { i = p; p = q; q = i; } for(i = p; i < q; i += (q - p) / X) { y = x * x + 2 * x - 4; total += y * (q - p) / X; } printf("\n\nValue of integration is:%.3f", total); getch(); return; }
No comments:
Post a Comment