Advertisement
Guest User

Untitled

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