answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

#include<math.h>

#define f(x) (sin(x*x))

void main()

{

float a,b,h,x,s,n,aaa,h1,h2,p=0.0,p1=0.0,pp,sum,k,i=0.0;

int j=1,co;

clrscr();

printf("\n Plese Enter lower limit :");

scanf("%f",&a);

printf("\n Plese Enter upper limit :");

scanf("%f",&b);

printf("\n Plese Enter the number of Intervales::");

scanf("%f",&n);

h=(b-a)/n; //Calculiting the value of h

printf("The ..................=%f",h);

x=a+h;

s=f(a)+f(b); //Calculiting the First term & last term

while(j<n)

{

if((j%2)==0) //checking even and odd terms

i=i+(2*f(x)); //Calculiting the even terms

else

i=i+(4*f(x)); //Calculiting the odd terms

x=x+h;

j++;

}

i=(h/3)*(i+s); //putting all data in to the formula

printf("\nThe value of the integral is %f",i);

// part is for Error calculation

h1=b-h; h2=a+h;

pp=(7*(f(h2)+f(h1)));

sum=a-h;

k=b+h;

x=a+(2*h);

for(co=2;co<n-2;co++)

{

if(co%2==0)

p=p+(f(x));

else

p1=p1+(f(x));

x=x+h;

}

aaa=(-(h/90))*( ( f(sum)+f(k) )-4*(s) +7*( f(h1) )-(8*p)+(8*p1) );

printf("\nThe Error is= %f",aaa);

getch();

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What season is The Simpsons episode separate vocations?

"Separate Vocations" is the 18th episode of The Simpsons' third seasonHope this helps


What are the second third and fourth Simpsons episodes?

Simpsons Roasting on an Open FireBart the GeniusHomer's OdysseyThere's No Disgrace Like Home


What episode of The Simpsons has the song I love candy?

'Simpsons Spin-off Showcase'. 'I want Candy' features in the third part, 'Simpsons Family Smile-time Variety Hour'.


Evaluate 32 4 plus 2 the third power -3 equal?

32 4 plus 2 the third power -3 cannot be evaluate.


What was the third word spoken by Lisa on the simpsons it was an actors name?

"David Hasselhoff".


What is the third step in a general rubric?

evaluate the passage


Who is cletus?

Cletus is a character from the simpsons dadadadada some Pope. I think he was the third pope


When was the third season of the Simpsons?

September 19th, 1991 - August 27th, 1992 Check out www.simpsoncrazy.com


When did the third series of The Simpsons first come out?

September 19, 1991 and May 7, 1992


What are the ratings and certificates for The Simpsons - 1989 Bart vs- Lisa vs- the Third Grade 14-3?

The Simpsons - 1989 Bart vs- Lisa vs- the Third Grade 14-3 is rated/received certificates of: Argentina:Atp USA:TV-PG (1997-Present)


What was the first place the Simpsons traveled to?

Bart went to France in the first season.They go to CapitolCity in the second. Washington D.C. in the third.


How do you write 4 to the third power?

43 is the conventional way. You could always evaluate it and write 64.