fibonacci_series 0.2.0

Fibonacci Sequence. The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is found by adding up the two numbers before it.
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 443.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 109.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • huzefagul92/PIAIC_IOT_BATCH-2_Q1
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • huzefagul92

1. Fibonacci Sequence:

The Fibonacci Sequence is the series of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

The next number is found by adding up the two numbers before it.

like

0 + 1 = 1 ,

1 + 1 = 2

and so on...

Want to learn more on fibonacci sequence

2. Imgaes:

below picture is the short story of Fibonacci Sequence

sparkles

3. Graphical Interpretation:

sparkles sparkles

The above two images are pictorial Interpretations of Fibonacci Series

4. Source Snapshot:

sparkles

5. Code Block:

    
        
    /* This program is for printing series of first 'N' (user given limit) Fibonacci Numbers on the console */

use std::io;

pub fn fibonacci() {

    println!("\n    Please enter the quantity of Fibonacci number series\n    ");
    let mut num = String::new();
    io::stdin().read_line(&mut num).expect("no data is given");
    let num : u32 = num.trim().parse().unwrap();
    
    let mut first   : usize = 0;
    let mut second  : usize = 1;
    let mut initial : usize = 0;
    let mut next    : usize; 
    println!("\n     The following is the Fibonacci series\n");
    println!("    **************************************\n");
                // for first N Fibonacci Series, we used 0..num Range pattern with num excluding
    for _x in 0..num {            
        if initial <= 1 {
            next = initial;
            initial= 1+initial;
        }

        else{
            next = first + second;
            first = second;
            second = next;
        }      
        println!("      Number-{} : {},   \n",_x+1, next); 
    }
}

"There are two ways to write error-free programs; only the third one works."

~AlanPerils