Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.

Friday, March 30, 2012

WAP of Simpson3/8 in C

/* WAP of Simpson3/8 in C */

#include<stdio.h>
#include<conio.h>
void main()
{
 float x[100],y[100],value2,value,fx,h;
 int i,size;
 clrscr();
 printf("How many value you want to enter: ");
 scanf("%d",&size);

 for(i=0; i<size; i++)
 {
  printf("Enter elements of x[%d]:\n",i);
  scanf("%f",&x[i]);
  printf("Enter elements of y[%d]:\n",i);
  scanf("%f",&y[i]);
 }
 h = x[2]-x[1];
 printf("\nh = %f",h);
 for(i=1; i<size-1; i++)
 {
  if(i%3==0)
   value2 += 2*y[i];

  else
   value += 3*y[i];
 }
 printf("value2 = %f \n value = %f",value2, value);
 fx = ( h*3)/8 * ( y[0] + y[size-1] + value + value2 );
 printf("\nf(x)= %f",fx);
 getch();
}

No comments:

Post a Comment

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share