Created
January 2, 2015 14:54
-
-
Save takanakahiko/b636dcc92a421cd79bec to your computer and use it in GitHub Desktop.
フィボナッチ数列のn番目とn+1番目の比率が黄金比に収束するやつ(1.2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GoldenMean { | |
public static void main (String[] args) { | |
int a = 1; | |
int b = 1; | |
int c; | |
for(int i = 0; i < 30; i++){ | |
System.out.println(i+"\ta="+a+"\tb="+b+"\tb/a="+((double)b/a)); | |
c = a + b; | |
a = b; | |
b = c; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment