# Fibonacci series program in swift basic program for beginners

Fibonacci series program in swift basic program for beginners. This program will print the Fibonacci number in swift program. Program like fibonacci series is the basic set of program for beginners who is learning swift programming language.

`var x = -1,y = 1,sum = 0;for i in 0..<20{sum = x+y;x   = y;y   = sum;print(sum);}`

Output:

0

1

1

2

## What is fibonacci series in swift programming

The Fibonacci sequence is a collection of numbers that begins with a one or a zero and ends with a one, following the rule that each number called a Fibonacci number is equal to the sum of the two numbers before it.

The ratios found in Fibonacci’s sequence are used to construct Fibonacci numbers and lines. The Fibonacci numbers 0.236, 0.382, 0.618, 1.618, 2.618, and 4.236 are commonly used in financial markets. Divide specific numbers in the series by other numbers to find these ratios or percentages.

## What is for loop in swift

A loop is used to repeatedly execute a set of statements until a certain condition is met. When showing numbers from 1 to 100, for example, you might wish to set the value of a variable to 1 and display it 100 times, raising its value by 1 with each loop iteration.