sivan_iut

Untitled

Feb 19th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int count;
  5.     scanf("%d",&count);
  6.     int sum=2;
  7.     int fibo;
  8.     int i;
  9.     int first=1;
  10.     int second=1;
  11.     for(i=1; i<=count-2; i++)
  12.     {
  13.         fibo=first+second;
  14.         sum=sum+fibo;
  15.         first=second;
  16.         second=sum;
  17.  
  18.  
  19.     }
  20.  
  21.     printf("%d",sum);
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.     return 0;
  30. }
Add Comment
Please, Sign In to add comment