Skip to content

Instantly share code, notes, and snippets.

@savaryna
Created December 4, 2014 14:16
Show Gist options
  • Save savaryna/bd0911deb228e7932572 to your computer and use it in GitHub Desktop.
Save savaryna/bd0911deb228e7932572 to your computer and use it in GitHub Desktop.
#include <conio.h>
#include <stdio.h>
// determina al n-lea numar Fibonacci
void main(){
int n,x,y,z,d;
printf("Introduceti un numar n: ");
scanf("%d",&n);
x=1;
y=1;
z=1;
for(d=3;d<=n;d++)
{
z=x+y;
x=y;
y=z;
}
printf("Al %d",n);
printf("-lea numar fibonacci ");
printf("este: %d",z);
printf("\n");
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment