#### Fibonacci Series coderinme

Have you ever heard of a Fibonacci Number?

Well In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144

Write a program in the sequence 1 1 2 3 5 8 13 21 ……………… and called Fibonacci numbers.

Write a program using a do…while loop to calculate and print the first m Fabonacci numbers.

Program:

```
import java.io.*;
public class Q13
{
public static void main(String[] args) throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the how many terms you want to print: ");
int m=Integer.parseInt(in.readLine());
int a=0,b=1,c,i=1;
System.out.print(b);
do {
c=a+b;
a=b;
b=c;
System.out.print(" "+c);
i++;
} while(i<m);
}
}
```

For more programs on Java, visit our Java Archives

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme