Advertisement
obernardovieira

AM2 1º desafio [Mathematica Challenge]

Feb 19th, 2015
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.32 KB | None | 0 0
  1. n <- strtoi(readline('Qual o grau do polimonio?'))
  2. a <- array(1:(n+1))
  3.  
  4. for(v in n:0)
  5.     a[v+1] <- strtoi(readline(sprintf("Introduza um valor para o 'a' na ordem #%1$1d", v)))
  6.  
  7. x0 <- strtoi(readline('Qual o valor de x?'))
  8.  
  9.  
  10. p <- a[n+1]
  11. for(z in (n):(1))
  12.     p <- p * x0 + a[z]
  13.  
  14.  
  15. print(sprintf("O resultado é %d", p))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement