Fibonacciho_posloupnost <- function(n) { if(n < 0 | round(n) - n != 0) return(paste("chybne cislo")) if (n == 0) {return(0)} if (n == 1) {return(1)} a <- 0 b <- 1 for (i in seq(2, n, by = 1)) { c <- a + b a <- b b <- c } return(b) }