polpoteu

AiSD Horner

Nov 13th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6.  
  7. int main(int argc, char** argv)
  8. {
  9.     cout<<"Podaj wielkosc tablicy : ";
  10.     int n;
  11.     cin>>n;
  12.     cout<<"Podaj wartosc x : ";
  13.     int x;
  14.     cin>>x;
  15.     int *a;
  16.     a = new int [n];
  17.     int v=0;
  18.     for (int i=n; i>=0; i--){
  19.         v=+a[i]+v*x;
  20.    
  21.     }
  22.  
  23.     cout<<v;
  24.     return 0;
  25. }
Add Comment
Please, Sign In to add comment