fork download
  1. # your code goes here
  2. fIter <- function(n) {
  3. if ( n < 2 )
  4. n
  5. else {
  6. f <- c(0, 1)
  7. for (i in 2:n) {
  8. t <- f[2]
  9. f[2] <- sum(f)
  10. f[1] <- t
  11. }
  12. f[2]
  13. }
  14. }
  15. fIter(100)
Success #stdin #stdout 0.45s 22824KB
stdin
Standard input is empty
stdout
[1] 3.542248e+20