csansoon

P3.16 P96767 Polynomial evaluation (1)

Oct 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.  
  6.     cout.setf(ios::fixed);
  7.     cout.precision(4);
  8.  
  9.     double x,f_de_x,f_de_y;
  10.     double exponencial=1;
  11.  
  12.     cin >> x >> f_de_y;
  13.  
  14.     while(cin >> f_de_x){
  15.         exponencial=exponencial*x;
  16.         f_de_y+=f_de_x*exponencial;
  17.     }
  18.  
  19.     cout << f_de_y << endl;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment