public class naloga_1 {
public static void main
(String[] args
) { int n = 0;
try {
String niz = javax.
swing.
JOptionPane.
showInputDialog("Koliko števil Fibonaccijevega želiš zaporedja sešteti?");
n =
Integer.
valueOf(niz
).
intValue();
}
int[] stevila = new int[n];
for(int i = 0; i < n; i++) {
if(i <= 1) {
stevila[i] = 1;
} else {
stevila[i] = stevila[i - 2] + stevila[i - 1];
}
}
int vsota = 0;
for(int i = 0; i < n; i++) {
vsota += stevila[i];
}
System.
out.
println("Sestevek " + n +
" stevil Fibonacijevega zaporedja je: " + vsota
);
}
}