- To print fibonacci series

User Input: 5

Output:

Fibonacci series : 0 1 1 2 3 5

```
import java.util.Scanner
fun main(args: Array<String>) {
print("Enter fibonacci series nth term : ")
val userInput = Scanner(System.`in`)
var num:Int = userInput.nextInt()
var a=0
var b=1
var next:Int
print("Your fibonacci series : ")
for(i in 0..num-1){
print("$a ")
next=a+b
a=b
b=next
}
}
```

Enter fibonacci series nth term : 8 Your fibonacci series : 0 1 1 2 3 5 8 13Program

number

You should know first :

**Fibonacci Series** : Series of numbers in which each number is the sum of the last 2 numbers

```
//Initially a & b :holds 1st & 2nd terms of fibonacci series
for(i in 0..num-1) {
print("$a ")
next=a+b;
a=b;
b=next;
}
```

Concept
Coming Soon !

QuickTutorial

In order to succeed you must fail, so that you know what not to do the next time.