Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cosmology
/* Calculo del número áureo a partir de la 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 = 100; int i = 0; int j = 1; double aureo = 1; System.out.println("fibonacci(0) = 0"); System.out.println("fibonacci(1) = 1"); for(int k=2; k<n; k++) { int t = i + j; if(i!=0) { aureo = (double)j/(double)i; System.out.println( "phi = ("+j+"/"+i+") = " + aureo); } System.out.println( "fibonacci("+ k + ") = " + t); i = j; j = t; } System.out.println(""); } }
run
|
edit
|
history
|
help
0
Coding Challenge - 01 (Even numbers)
Leetcode 297. Serialize and Deserialize Binary Tree
assignment 3
f
homework
Size and signedness of Java ints and longs
쓰레드 critical section
Preference List
Sqrt
4a