Miti059

8.To print fibonacci series up to n terms

Jun 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.16 KB | None | 0 0
  1. #include<stdio.h>
  2. main()
  3. {
  4. int i,n,a=0,b=1,c;
  5. scanf("%d",&n);
  6. for(i=1;i<=n;i++)
  7. {
  8.     printf("%d\n",a);
  9.     c=a+b;
  10.     a=b;
  11.     b=c;
  12. }
  13.  
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment