diff --git a/week1/day1/assignments/FibonacciSeries.java b/week1/day1/assignments/FibonacciSeries.java index 5b6e5ae..e565344 100644 --- a/week1/day1/assignments/FibonacciSeries.java +++ b/week1/day1/assignments/FibonacciSeries.java @@ -1,36 +1,23 @@ package week1.day1.assignments; - public class FibonacciSeries { - - /* - * Goal: To find Fibonacci Series for a given range - * - * input(range): 8 output: 0, 1, 1, 2, 3, 5, 8, 13 - * - * Shortcuts: 1) Print : type: syso, followed by: ctrl + space + enter 2) To - * create a 'for' loop: type 'for', followed by ctrl + space + down arrow + - * enter - * - * What are my learnings from this code? 1) 2) 3) - * - */ - public static void main(String[] args) { - - // initialize 3 int variables (Tip: range = 8, firstNum = 0, secNum = 1, sum in the series) - - // Print first number - - // Iterate from 1 to the range - - // add first and second number assign to sum - - // Assign second number to the first number - - // Assign sum to the second number - - // print sum - + Fibonacci(8); } + + public static void Fibonacci(int n ) { + int firstNum =0; + int secondNum =1; + int sum; + System.out.print(firstNum +","+ secondNum); + for (int i=2;i