Hellrocker

Untitled

Apr 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main(){
  4. clrscr();
  5. int nstuds[]={31,42,51,35,31};
  6. float p=(45-40)/10;
  7. float dy[5][5];
  8. float sum=0;
  9. for(int i=0;i<5;i++){
  10. sum=sum+nstuds[i];
  11. dy[0][i]=sum;
  12. }
  13. float yp=0;
  14. for(i=1;i<5;i++){
  15. for(int j=0;j<5-i;j++){
  16. dy[i][j]=dy[i-1][j+1]-dy[i-1][j];
  17. }
  18. }
  19. //float fp=1,fi=1;
  20. for(i=0;i<5;i++){
  21. float fp=1,fi=1;
  22. for(int j=0;j<1;j++){
  23. fp=fp*(p-(float)j);
  24. cout<<fp<<",";
  25. fi=fi*((float)(i-j));
  26. cout<<fi;
  27. }
  28. yp=yp+((fp/fi)*dy[i][0]);
  29. }
  30. cout<<"Number of students: "<<yp;
  31. getch();
  32. }
Add Comment
Please, Sign In to add comment