Created
December 4, 2014 14:16
-
-
Save savaryna/bd0911deb228e7932572 to your computer and use it in GitHub Desktop.
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
#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