Answers for "non fibonacci series in java"

1

fibonacci series in java

// fibonacci series in java using while loop
public class FibonacciSeriesWhileLoop
{
   public static void main(String[] args)
   {
      int a = 1, num = 15, num1 = 0, num2 = 1;
      System.out.print("First " + num + " fibonacci sequence: ");
      while(a <= num)
      {
         System.out.print(num1 + " , ");
         int total = num1 + num2;
         num1 = num2;
         num2 = total;
         a++;
      }
   }
}
Posted by: Guest on December-05-2020

Code answers related to "non fibonacci series in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language