We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
0 parents commit 6fe1b22Copy full SHA for 6fe1b22
src/Fibonacci.java
@@ -0,0 +1,18 @@
1
+import java.io.*;
2
+public class Fibonacci {
3
+ public static void main(String[] args)throws IOException{
4
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
5
+
6
+ int q = Integer.parseInt(br.readLine());
7
+ long[] f = new long[q]; // DON'T TAKE INTS ;)
8
+ f[0] = 0;
9
+ f[1] = 1;
10
11
+ for(int i=2; i<q; i++){
12
+ f[i] = f[i-1] + f[i-2];
13
+ }
14
15
+ System.out.println(f[q-1]);
16
17
18
+}
0 commit comments