Skip to content

Instantly share code, notes, and snippets.

@cagataycali
Created October 3, 2015 13:58
Show Gist options
  • Save cagataycali/51ca228c226685cf8b21 to your computer and use it in GitHub Desktop.
Save cagataycali/51ca228c226685cf8b21 to your computer and use it in GitHub Desktop.
Fibonacci sayılarını ekrana yazar
/* Fibonacci sayilarini ekrana yazar */
#include<stdio.h>int main( void )
{
int a = 0; /* a[n] */
int b = 1; /* a[n+1] */
int c; /* a[n+2] */
int n;
int i;
printf("Fibonacci serisi kacinci elemana kadar yazilsin> ");
scanf("%d", &n);
for( i = 1; i <= n ; i++ ) {
printf( "%4d. Eleman: %d\n", i, a );
c = a + b;
a = b;
b = c;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment