Advertisement
Guest User

Untitled

a guest
May 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. int main(int a, int b){
  2.  
  3. int n = null,
  4. first = 0,
  5. second = 1,
  6. next = null,
  7. c = null;
  8. printf("Enter the number of terms\n");
  9. scanf("%d", &n);
  10. printf("First %d terms of Fibonacci series are :-\n", n);
  11. for (c = 0;c < n;n++) {
  12.  
  13. if (c <= 1) {
  14.  
  15. next = c;
  16.  
  17. }
  18. else {
  19.  
  20. next = (first + second);
  21. first = second;
  22. second = next;
  23.  
  24. }
  25. printf("%d\n", next)
  26.  
  27. }
  28. ;
  29. return 0;
  30.  
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement