Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- int n, a, b, c, nrNumere = 0;
- printf("numar= "); scanf("%u", &n);
- if (n < 1) {
- printf("Nu se poate scrie!\n");
- return 0;
- }
- while (n)
- {
- a = 0;
- b = 1;
- while (a + b <= n)
- {
- c = a + b;
- a = b;
- b = c;
- }
- n -= c;
- ++nrNumere;
- }
- printf("Se poate scrie ca %d numere din sirul lui fibonacci\n", nrNumere);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement