Advertisement
raisul82

Fibonacci number

Sep 26th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int f=0,s=1,i,j,next;
  5. printf("how many number you want to show : ");
  6. scanf("%d",&j);
  7. for(i=0; i<j; i++)
  8. {
  9. if(i<=1)
  10. {
  11. printf("%d ",i);
  12. }
  13. else
  14. {
  15. next=f+s;
  16. f=s;
  17. s=next;
  18. printf("%d ",next);
  19. }
  20. }
  21. return 0;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement