From 0ecd0494b853b6039d7bdc2cdd7bc28b882aee7a Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:02:35 +0000 Subject: [PATCH] Documentation for 144442afba8b45709d0c3fe7b8992a1e3d6bac82 --- d0/d6f/fibonacci_8c.html | 354 ++++++++++++++++++ d0/d6f/fibonacci_8c.js | 7 + ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 4 + ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 1 + ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 42 +++ ...082919377416805160894716b2344d7_cgraph.map | 3 + ...082919377416805160894716b2344d7_cgraph.md5 | 1 + ...082919377416805160894716b2344d7_cgraph.svg | 27 ++ ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 6 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 1 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 78 ++++ d3/d09/fibonacci_8c__incl.map | 8 + d3/d09/fibonacci_8c__incl.md5 | 1 + d3/d09/fibonacci_8c__incl.svg | 96 +++++ dir_296d53ceaeaa7e099814a6def439fe8a.html | 3 + dir_296d53ceaeaa7e099814a6def439fe8a.js | 1 + files.html | 13 +- globals_b.html | 2 +- globals_defs.html | 4 +- globals_f.html | 2 +- globals_func_b.html | 2 +- globals_func_f.html | 2 +- globals_func_g.html | 1 + globals_func_i.html | 2 +- globals_func_m.html | 2 +- globals_func_t.html | 2 +- globals_g.html | 1 + globals_i.html | 2 +- globals_m.html | 6 +- globals_t.html | 2 +- navtreedata.js | 8 +- navtreeindex0.js | 12 +- navtreeindex1.js | 26 +- navtreeindex2.js | 28 +- navtreeindex3.js | 16 +- navtreeindex4.js | 5 + search/all_16.js | 4 +- search/all_4.js | 4 +- search/all_8.js | 37 +- search/all_9.js | 17 +- search/all_b.js | 4 +- search/all_f.js | 10 +- search/files_6.js | 7 +- search/functions_14.js | 2 +- search/functions_2.js | 4 +- search/functions_6.js | 2 +- search/functions_7.js | 9 +- search/functions_9.js | 4 +- search/functions_d.js | 2 +- 49 files changed, 761 insertions(+), 116 deletions(-) create mode 100644 d0/d6f/fibonacci_8c.html create mode 100644 d0/d6f/fibonacci_8c.js create mode 100644 d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map create mode 100644 d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 create mode 100644 d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg create mode 100644 d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.map create mode 100644 d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.md5 create mode 100644 d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.svg create mode 100644 d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map create mode 100644 d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 create mode 100644 d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg create mode 100644 d3/d09/fibonacci_8c__incl.map create mode 100644 d3/d09/fibonacci_8c__incl.md5 create mode 100644 d3/d09/fibonacci_8c__incl.svg diff --git a/d0/d6f/fibonacci_8c.html b/d0/d6f/fibonacci_8c.html new file mode 100644 index 00000000..f7ce4dab --- /dev/null +++ b/d0/d6f/fibonacci_8c.html @@ -0,0 +1,354 @@ + + + + + + + +Algorithms_in_C: math/fibonacci.c File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C 1.0.0 +
+
Set of algorithms implemented in C.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
fibonacci.c File Reference
+
+
+ +

Program to print the nth term of the Fibonacci series. +More...

+
#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+Include dependency graph for fibonacci.c:
+
+
+
+
+
+ + + + + + + + + + + + + +

+Functions

unsigned int fib (int number)
 for assert() for errno - to determine whether there is an error while using strtol()
 
int getInput (void)
 Get the input from the user.
 
static void test ()
 self-test implementation
 
int main ()
 Main function.
 
+

Detailed Description

+

Program to print the nth term of the Fibonacci series.

+

Fibonacci series generally starts from 0 and 1. Every next term in the series is equal to the sum of the two preceding terms. For further info: https://en.wikipedia.org/wiki/Fibonacci_sequence

+
Author
Luiz Carlos Aguiar C
+
+Niranjan
+

Function Documentation

+ +

◆ fib()

+ +
+
+ + + + + + + + +
unsigned int fib (int number)
+
+ +

for assert() for errno - to determine whether there is an error while using strtol()

+

for input, output for exit() - to exit the program to calculate time taken by fib()

+

Determines the nth Fibonacci term

Parameters
+ + +
number- n in "nth term" and it can't be negative as well as zero
+
+
+
Returns
nth term in unsigned type
+
Warning
Only till 47th and 48th fibonacci element can be stored in int and unsigned int respectively (takes more than 20 seconds to print)
+
27{
+
28 // Check for negative integers
+
29 if (number <= 0)
+
30 {
+
31 fprintf(stderr, "Illegal Argument Is Passed!\n");
+
32 exit(EXIT_FAILURE);
+
33 }
+
34
+
35 // Base conditions
+
36 if (number == 1)
+
37 return 0;
+
38
+
39 if (number == 2)
+
40 return 1;
+
41
+
42 // Recursive call to the function
+
43 return fib(number - 1) + fib(number - 2);
+
44}
+
unsigned int fib(int number)
for assert() for errno - to determine whether there is an error while using strtol()
Definition: fibonacci.c:26
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ getInput()

+ +
+
+ + + + + + + + +
int getInput (void )
+
+ +

Get the input from the user.

+
Returns
valid argument to the fibonacci function
+
51{
+
52 int num, excess_len;
+
53 char buffer[3], *endPtr;
+
54
+
55 while (1)
+
56 { // Repeat until a valid number is entered
+
57 printf("Please enter a valid number:");
+
58 fgets(buffer, 3, stdin); // Inputs the value from user
+
59
+
60 excess_len = 0;
+
61 if (!(buffer[0] == '\n' ||
+
62 buffer[1] == '\n' ||
+
63 buffer[2] == '\n')) {
+
64 while (getchar() != '\n') excess_len++;
+
65 }
+
66
+
67 num = strtol(buffer, &endPtr,
+
68 10); // Attempts to convert the string to integer
+
69
+
70 // Checking the input
+
71 if ( // The number is too large
+
72 (excess_len > 0 || num > 48) ||
+
73 // Characters other than digits are included in the input
+
74 (*endPtr != '\0' && *endPtr != '\n') ||
+
75 // No characters are entered
+
76 endPtr == buffer)
+
77 {
+
78 continue;
+
79 }
+
80
+
81 break;
+
82 }
+
83
+
84 printf("\nEntered digit: %d (it might take sometime)\n", num);
+
85 return num;
+
86}
+
struct used to store character in certain times
Definition: min_printf.h:31
+
+
+
+ +

◆ main()

+ +
+
+ + + + + + + + +
int main (void )
+
+ +

Main function.

+
Returns
0 on exit
+
104{
+
105 // Performing the test
+
106 test();
+
107 printf("Tests passed...\n");
+
108
+
109 // Getting n
+
110 printf(
+
111 "Enter n to find nth fibonacci element...\n"
+
112 "Note: You would be asked to enter input until valid number ( less "
+
113 "than or equal to 48 ) is entered.\n");
+
114
+
115 int number = getInput();
+
116 clock_t start, end;
+
117
+
118 start = clock();
+
119 printf("Fibonacci element %d is %u ", number, fib(number));
+
120 end = clock();
+
121
+
122 printf("in %.3f seconds.\n", ((double)(end - start)) / CLOCKS_PER_SEC );
+
123 return 0;
+
124}
+
static void test()
self-test implementation
Definition: fibonacci.c:92
+
int getInput(void)
Get the input from the user.
Definition: fibonacci.c:50
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + + +
static void test (void )
+
+static
+
+ +

self-test implementation

+
Returns
void
+
93{
+
94 assert(fib(5) == 3);
+
95 assert(fib(2) == 1);
+
96 assert(fib(9) == 21);
+
97}
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+
+
+ + + + diff --git a/d0/d6f/fibonacci_8c.js b/d0/d6f/fibonacci_8c.js new file mode 100644 index 00000000..f89f2a12 --- /dev/null +++ b/d0/d6f/fibonacci_8c.js @@ -0,0 +1,7 @@ +var fibonacci_8c = +[ + [ "fib", "d0/d6f/fibonacci_8c.html#ae082919377416805160894716b2344d7", null ], + [ "getInput", "d0/d6f/fibonacci_8c.html#aeb1b48abe7f99ab8e1d71426f28ab025", null ], + [ "main", "d0/d6f/fibonacci_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "test", "d0/d6f/fibonacci_8c.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map new file mode 100644 index 00000000..de190110 --- /dev/null +++ b/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 new file mode 100644 index 00000000..98b24564 --- /dev/null +++ b/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -0,0 +1 @@ +8892b24573623440255eb30f14ca4058 \ No newline at end of file diff --git a/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg new file mode 100644 index 00000000..08922eda --- /dev/null +++ b/d0/d6f/fibonacci_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -0,0 +1,42 @@ + + + + + + +test + + +Node1 + + +test + + + + + +Node2 + + +fib + + + + + +Node1->Node2 + + + + + +Node2->Node2 + + + + + diff --git a/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.map b/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.map new file mode 100644 index 00000000..d8e86217 --- /dev/null +++ b/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.map @@ -0,0 +1,3 @@ + + + diff --git a/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.md5 b/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.md5 new file mode 100644 index 00000000..3e629f0e --- /dev/null +++ b/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.md5 @@ -0,0 +1 @@ +72f007cc6cae90c113d3e1756fb513aa \ No newline at end of file diff --git a/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.svg b/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.svg new file mode 100644 index 00000000..f55a4d24 --- /dev/null +++ b/d0/d6f/fibonacci_8c_ae082919377416805160894716b2344d7_cgraph.svg @@ -0,0 +1,27 @@ + + + + + + +fib + + +Node1 + + +fib + + + + + +Node1->Node1 + + + + + diff --git a/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 00000000..f5aad4aa --- /dev/null +++ b/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 00000000..59cc0d63 --- /dev/null +++ b/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +7d25fd4eeabf89bdd64dc32ebcb7524b \ No newline at end of file diff --git a/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 00000000..352ad865 --- /dev/null +++ b/d0/d6f/fibonacci_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,78 @@ + + + + + + +main + + +Node1 + + +main + + + + + +Node2 + + +fib + + + + + +Node1->Node2 + + + + + +Node3 + + +getInput + + + + + +Node1->Node3 + + + + + +Node4 + + +test + + + + + +Node1->Node4 + + + + + +Node2->Node2 + + + + + +Node4->Node2 + + + + + diff --git a/d3/d09/fibonacci_8c__incl.map b/d3/d09/fibonacci_8c__incl.map new file mode 100644 index 00000000..72b1043c --- /dev/null +++ b/d3/d09/fibonacci_8c__incl.map @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/d3/d09/fibonacci_8c__incl.md5 b/d3/d09/fibonacci_8c__incl.md5 new file mode 100644 index 00000000..1f0d3588 --- /dev/null +++ b/d3/d09/fibonacci_8c__incl.md5 @@ -0,0 +1 @@ +854f84037b1872694183be6dda5acd4e \ No newline at end of file diff --git a/d3/d09/fibonacci_8c__incl.svg b/d3/d09/fibonacci_8c__incl.svg new file mode 100644 index 00000000..c715f88a --- /dev/null +++ b/d3/d09/fibonacci_8c__incl.svg @@ -0,0 +1,96 @@ + + + + + + +math/fibonacci.c + + +Node1 + + +math/fibonacci.c + + + + + +Node2 + + +assert.h + + + + + +Node1->Node2 + + + + + +Node3 + + +errno.h + + + + + +Node1->Node3 + + + + + +Node4 + + +stdio.h + + + + + +Node1->Node4 + + + + + +Node5 + + +stdlib.h + + + + + +Node1->Node5 + + + + + +Node6 + + +time.h + + + + + +Node1->Node6 + + + + + diff --git a/dir_296d53ceaeaa7e099814a6def439fe8a.html b/dir_296d53ceaeaa7e099814a6def439fe8a.html index 0126d0f6..79de7f9f 100644 --- a/dir_296d53ceaeaa7e099814a6def439fe8a.html +++ b/dir_296d53ceaeaa7e099814a6def439fe8a.html @@ -118,6 +118,9 @@ Files file  factorial_large_number.c  Compute factorial of arbitrarily large numbers by storing individual digits in a byte.
  +file  fibonacci.c + Program to print the nth term of the Fibonacci series.
+  file  fibonacci_fast.c  Compute \(m^{mth}\) Fibonacci number using the formulae:
  diff --git a/dir_296d53ceaeaa7e099814a6def439fe8a.js b/dir_296d53ceaeaa7e099814a6def439fe8a.js index 32a459c8..c4be846a 100644 --- a/dir_296d53ceaeaa7e099814a6def439fe8a.js +++ b/dir_296d53ceaeaa7e099814a6def439fe8a.js @@ -5,6 +5,7 @@ var dir_296d53ceaeaa7e099814a6def439fe8a = [ "collatz.c", "dc/d80/collatz_8c.html", "dc/d80/collatz_8c" ], [ "euclidean_algorithm_extended.c", "d5/df9/euclidean__algorithm__extended_8c.html", "d5/df9/euclidean__algorithm__extended_8c" ], [ "factorial_large_number.c", "d6/d3d/factorial__large__number_8c.html", "d6/d3d/factorial__large__number_8c" ], + [ "fibonacci.c", "d0/d6f/fibonacci_8c.html", "d0/d6f/fibonacci_8c" ], [ "fibonacci_fast.c", "d4/d99/fibonacci__fast_8c.html", "d4/d99/fibonacci__fast_8c" ], [ "fibonacci_formula.c", "d8/d75/fibonacci__formula_8c.html", "d8/d75/fibonacci__formula_8c" ], [ "palindrome.c", "df/d16/palindrome_8c.html", "df/d16/palindrome_8c" ], diff --git a/files.html b/files.html index 0d5a2cd4..c1f65357 100644 --- a/files.html +++ b/files.html @@ -209,12 +209,13 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });  collatz.cImplementation of Collatz' conjecture  euclidean_algorithm_extended.cProgram to perform the extended Euclidean algorithm  factorial_large_number.cCompute factorial of arbitrarily large numbers by storing individual digits in a byte - fibonacci_fast.cCompute \(m^{mth}\) Fibonacci number using the formulae: - fibonacci_formula.cFinding Fibonacci number of any n number using [Binet's closed form formula](https://en.wikipedia.org/wiki/Fibonacci_number#Binet's_formula) compute \(f_{nth}\) Fibonacci number using the binet's formula: Fn = 1√5 * (1+√5 / 2)^n+1 − 1√5 * (1−√5 / 2)^n+1 - palindrome.cProgram to identify if a number is palindrome number or not - prime.cProgram to identify if a number is prime number or not - prime_sieve.cPrime Sieve algorithm implementation - strong_number.cStrong number is a number whose sum of all digits’ factorial is equal to the number n For example: 145 = 1!(1) + 4!(24) + 5!(120) + fibonacci.cProgram to print the nth term of the Fibonacci series + fibonacci_fast.cCompute \(m^{mth}\) Fibonacci number using the formulae: + fibonacci_formula.cFinding Fibonacci number of any n number using [Binet's closed form formula](https://en.wikipedia.org/wiki/Fibonacci_number#Binet's_formula) compute \(f_{nth}\) Fibonacci number using the binet's formula: Fn = 1√5 * (1+√5 / 2)^n+1 − 1√5 * (1−√5 / 2)^n+1 + palindrome.cProgram to identify if a number is palindrome number or not + prime.cProgram to identify if a number is prime number or not + prime_sieve.cPrime Sieve algorithm implementation + strong_number.cStrong number is a number whose sum of all digits’ factorial is equal to the number n For example: 145 = 1!(1) + 4!(24) + 5!(120)   misc  hamming_distance.cHamming distance algorithm implementation  mcnaughton_yamada_thompson.cMcNaughton–Yamada–Thompson algorithm diff --git a/globals_b.html b/globals_b.html index 4ab3bce7..173bb183 100644 --- a/globals_b.html +++ b/globals_b.html @@ -110,8 +110,8 @@ $(document).ready(function(){initNavTree('globals_b.html',''); initResizable();
  • binarysearch1() : binary_search.c
  • binarysearch2() : binary_search.c
  • bisection() : bisection_method.c
  • -
  • BLAKE2B() : hash_blake2b.c
  • blake2b() : hash_blake2b.c
  • +
  • BLAKE2B() : hash_blake2b.c
  • blake2b_iv : hash_blake2b.c
  • blake2b_sigma : hash_blake2b.c
  • block_t : hash_blake2b.c
  • diff --git a/globals_defs.html b/globals_defs.html index b62633be..ce583e00 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -152,8 +152,8 @@ $(document).ready(function(){initNavTree('globals_defs.html',''); initResizable(

    - m -

    diff --git a/globals_f.html b/globals_f.html index 819a2215..493166e4 100644 --- a/globals_f.html +++ b/globals_f.html @@ -101,7 +101,7 @@ $(document).ready(function(){initNavTree('globals_f.html',''); initResizable();

    - f -