-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete unnecessary files and fix indentation
- Loading branch information
1 parent
35aa2b8
commit c822de7
Showing
18 changed files
with
133 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
*/ | ||
int main(void) | ||
{ | ||
print_alphabet(); | ||
return (0); | ||
print_alphabet(); | ||
return (0); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <stdio.h> | ||
|
||
/** | ||
* main - Prints the first 98 Fibonacci numbers, starting with 1 and 2. | ||
* | ||
* The numbers are separated by a comma followed by a space. The program | ||
* manages the Fibonacci numbers in two parts to handle the large numbers | ||
* involved, and it handles overflow manually. | ||
* | ||
* Return: Always 0. | ||
*/ | ||
int main(void) | ||
{ | ||
/* The lower and upper parts of the current and next Fibonacci numbers */ | ||
unsigned int a1 = 0, a2 = 1, b1 = 0, b2 = 2, next1, next2, count; | ||
|
||
/* Print the first two Fibonacci numbers */ | ||
printf("1, 2"); | ||
|
||
/* Calculate and print the next 96 Fibonacci numbers */ | ||
for (count = 2; count < 98; count++) | ||
{ | ||
/* Calculate the next Fibonacci number */ | ||
next1 = a1 + b1; | ||
next2 = a2 + b2 + (next1 / 1000000000); | ||
next1 = next1 % 1000000000; | ||
|
||
/* Print the next Fibonacci number */ | ||
if (next2 > 0) | ||
printf(", %u%09u", next2, next1); | ||
else | ||
printf(", %u", next1); | ||
|
||
/* Update current & next Fibonacci numbers for next loop iteration */ | ||
a1 = b1; | ||
a2 = b2; | ||
b1 = next1; | ||
b2 = next2; | ||
} | ||
|
||
/* Print a newline at the end */ | ||
printf("\n"); | ||
|
||
/* Return 0 to indicate successful completion */ | ||
return (0); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
*/ | ||
int main(void) | ||
{ | ||
print_alphabet_x10(); | ||
return (0); | ||
print_alphabet_x10(); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
*/ | ||
int main(void) | ||
{ | ||
jack_bauer(); | ||
return (0); | ||
jack_bauer(); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
*/ | ||
int main(void) | ||
{ | ||
times_table(); | ||
return (0); | ||
times_table(); | ||
return (0); | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ | |
void times_table(void); | ||
int add(int, int); | ||
void print_to_98(int n); | ||
void print_times_table(int n); | ||
#endif |