Skip to content

Commit

Permalink
In computer class
Browse files Browse the repository at this point in the history
  • Loading branch information
david-hero committed Sep 23, 2022
1 parent a8ff987 commit 67cba6c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 0x02-functions_nested_loops/102-fibonacci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>

/**
*main - prints out first 50
*fibonacci suit numbers
*Return: return 0
*/

int main(void)
{
int inc;
unsigned long n1 = 0, n2 = 1, n3;
for (inc = 0; inc < 50; inc++)
{
n3 = n1 + n2;
printf("%lu", n3);
n1 = n2;
n2 = n3;
if (inc == 49)
printf("\n");
else
printf(", ");
}
return (0);
}

0 comments on commit 67cba6c

Please sign in to comment.