Fibonacci in Octave

Published on 09 December 2023 (Updated: 09 December 2023)

Welcome to the Fibonacci in Octave page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

function fibonacci()
    usage = 'Usage: please input the count of fibonacci numbers to output';
    arg_list = argv();
    nargin = length(arg_list);
    if nargin == 0
        disp(usage);
        return;
    end

    n = str2num(arg_list{1});
    if length(n) ~= 1 || mod(n, 1) ~= 0
        disp(usage);
        return;
    end

    a(1) = 1;
    a(2) = 1;

    for i=1:n
        a(i+2) = a(i+1) + a(i);
        printf('%d: %d\n', i, a(i));
    end
end

Fibonacci in Octave was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.