Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n,i;
- printf("Number of Terms: ");
- scanf("%d",&n);
- int ara[n];
- //assign the terms
- ara[0] = 0, ara[1] = 1;
- for(i=2 ; i<n ; i++)
- ara[i] = ara[i-1] + ara[i-2];
- //print the terms
- printf("The First %d Fibonacci Terms are: ",n);
- for(i=0 ; i<n ; i++)
- printf("%d ",ara[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement