Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- double x[5]= {20,23,26,29,32};
- double y[5][5]= {0.00};
- y[0][0]=0.3420;
- y[1][0]=0.3907;
- y[2][0]=0.4384;
- y[3][0]=0.4848;
- y[4][0]=0.5295;
- int i,j,row,col,n=5;
- for(i=1; i<n; i++)
- {
- for(j=0; j<n-i; j++)
- y[j][i]=y[j+1][i-1]-y[j][i-1];
- }
- for( row=0; row<n; row++)
- {
- cout<<x[row];
- for( col=0; col<n-row; col++)
- printf("%f ",y[row][col]);
- cout<<endl;
- }
- double p=(double)(21-20)/3;
- cout<<"P= "<<p<<endl;
- double fx=y[0][0]+p*y[0][1]+((p*(p-1))/2*1)*y[0][2]+((p*(p-1)*(p-2))/3*2*1)*y[0][3]+((p*(p-1)*(p-1)*(p-3)/4*3*2*1)*y[0][4]);
- cout<<"Fx= "<<fx;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement