Skip to content

Commit

Permalink
Create FibonacciiSeries
Browse files Browse the repository at this point in the history
  • Loading branch information
oshada2002 authored and StepJes committed Oct 17, 2023
1 parent 2dff2cf commit a7d4cb6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions FibonacciiSeries
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class FibonacciiSeries {

public static void main(String[] args)
{
int maxNumber = 10;
int previousNumber = 0;
int nextNumber = 1;

System.out.print("Fibonacci Series of "+maxNumber+" numbers:");

for (int i = 1; i <= maxNumber; ++i)
{
System.out.print(previousNumber+" ");

int sum = previousNumber + nextNumber;
previousNumber = nextNumber;
nextNumber = sum;
}
}
}

0 comments on commit a7d4cb6

Please sign in to comment.