Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
compile java online
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
/* Sucesión de Fibonacci Autor: Enrique Benimeli Publicado en www.esferatic.com */ /* Copyright (C) 2012 Enrique Benimeli This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { final int n = 25; int i = 0; int j = 1; System.out.println("fibonacci(0) = 0"); System.out.println("fibonacci(1) = 1"); for(int k=2; k<n; k++) { int t = i + j; System.out.println( "fibonacci("+ k + ") = " + t); i = j; j = t; } System.out.println(""); } }
[
+
]
Show input
Compilation time: 0.43 sec, absolute running time: 0.14 sec, cpu time: 0.06 sec, memory peak: 10 Mb, absolute service time: 0.73 sec
edit mode
|
history