Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- float prev=1, current=1, next=2, summa=0, m;
- cin>>m;
- summa+=prev;
- while(current<=m){
- summa+=current;
- prev=current;
- current=next;
- next=prev+current;
- }
- cout<<summa;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement