Advertisement
Rehan_Rahman26

Uri 1151

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