Advertisement
Md_hosen_zisad

fibonnaci

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