Last active
December 4, 2017 22:16
-
-
Save dhhdev/b1ae31ae8ad0bf8e658aad8292dc3b8c to your computer and use it in GitHub Desktop.
Fibonacci sequence between start and end term.
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
/* | |
* Fibonacci squence between start and end term. | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int a = 0; | |
int b = 1; | |
int c = 0; | |
int start = 10; | |
int end = 40; | |
while (c <= end) | |
{ | |
if (c >= start) { | |
printf("%d, ", c); | |
} | |
a = b; | |
b = c; | |
c = a + b; | |
} | |
printf("\n"); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment