Skip to content

Instantly share code, notes, and snippets.

@SohanChy
Created July 7, 2015 06:58
Show Gist options
  • Save SohanChy/2432a9c9533696521f3e to your computer and use it in GitHub Desktop.
Save SohanChy/2432a9c9533696521f3e to your computer and use it in GitHub Desktop.
Simple Fibonacci printing using function
#include <stdio.h>
#include <stdlib.h>
void fibo(int end);
int main()
{
fibo (10);
return 0;
}
void fibo (int end)
{
int x, first = 0, second = 1;
for( x= 0; x< end; x++)
{
printf("%d %d ",first,second);
first = first + second;
second = first + second;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment