answersLogoWhite

0

ITS EASY...

TRY THIS OUT..

TRAPEZOIDAL METHOD

#include

#include

#include

float valcal(float x){

return (x*x*x);

}

int main(){

float a,b,h,c,I;

int n,i;

printf("THE TRAPEZOIDAL RULE:\n");

printf("---------------------");

printf("\n\n\nEnter the two limits and the no. of divisions:\n");

scanf("%f %f %d",&a, &b, &n);

h=(b-a)/n;

//printf("\nVALUE of h: %f\n", h);

c=a;

I=valcal(a)+valcal(b);

//printf("\nVALUE FOR a: %f\n", valcal(a));

//printf("\nVALUE FOR b: %f\n", valcal(b));

for(i=1;i

c=c+h;

//printf("\nValue of c for loop %d: is %f\n ",i,c);

if(c>=b){

printf("\n\nc>b\n\n");

break;

}

//printf("\nVALUE FOR %f: is %f\n",c, valcal(c));

I=I+(2*valcal(c));

//printf("\nI right now is %f", I);

}

printf("\n\n\nThe integration of x*x*x is: %f",(h*I)/2);

printf("\n\n\n");

system("pause");

}

SIMPSON'S 1/3RD METHOD

#include

#include

#include

float valcal(float x){

return (1/(1+x*x));

}

int main(){

float a,b,h,c,I;

int n,i;

printf("THE SIMPSON'S ONE-THIRD RULE:\n");

printf("------------------------------");

printf("\n\n\nEnter the two limits and the no. of divisions:\n");

scanf("%f %f %d",&a, &b, &n);

h=(b-a)/n;

//printf("\nVALUE of h: %f\n", h);

c=a;

I=valcal(a)+valcal(b);

//printf("\nVALUE FOR a: %f\n", valcal(a));

//printf("\nVALUE FOR b: %f\n", valcal(b));

for(i=1;i

c=c+h;

//printf("\nValue of c for loop %d: is %f\n ",i,c);

if(c>b){

printf("\n\nc>b\n\n");

break;

}

//printf("\nVALUE FOR %f: is %f\n",c, valcal(c));

if(i%2==0)

I=I+(2*valcal(c));

else

I=I+4*valcal(c);

//printf("\nI right now is %f", I);

}

printf("\n\n\nThe integration of x*x*x is: %f",(h*I)/3);

printf("\n\n\n");

system("pause");

}

NEED MORE HELP...

MAIL ME YOUR PROB... SEE YA

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Write a program in c language to implement framing methods like character stuffing?

A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.


Is The Simpsons a naughty program?

No.


Like not just the family all Simpsons?

no but the program family is like the simpsons


What is Robert Pattinsons fav tv program?

simpsons


What is the name of Russian leader who followed Peter the Great and continued to implement his program?

Catherine followed Peter the Great and continued to implement his program.


Write a program to implement prim's algorithm?

dfgbrgffee


What year did Reagan implement the amnesty program?

1986


Write a program to implement domain and referential integrity?

give me the program which can related on domain and referential integrity.


Write A program to implement insertion using AVL trees?

yes


Who is the focal point for developing the process structure and training to implement the Army safety program?

The commander, USACR/SC is the focal point for developing the processes, structure, and training necessary to implement the Army Safety Program.


Who is the focal point developing the processes structure and training to implement the army safety program?

The commander, USACR/SC is the focal point for developing the processes, structure, and training necessary to implement the Army Safety Program.


How can you make a chip and implement it with a software program so that as your program it can work?

To make a chip and implement it with a software program, you need to "burn" the program into the chip before it can work. You must use special chips, called programmable read only memory chips, commonly called PROMs, for this. It also requires special machinery to program the chips.