Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- int main(void) {
- int n, x0, p;
- int *a;
- cout << "Qual o grau do polimonio? ";
- cin >> n;
- a = new int[n + 1];
- for (int v = n; v != -1; v--) {
- cout << "Introduza um valor para o 'a' na ordem #" << v << " :";
- cin >> a[v];
- }
- cout << "Qual o valor de x? ";
- cin >> x0;
- p = a[n];
- for (int z = n - 1; z != -1; z--)
- p = p * x0 + a[z];
- cout << "O resultado é " << p << endl;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement