Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main(){
  5. int x, a, y, z, t, k;
  6. x = 0; a = 0; y = 1; z = 0; t = 0;
  7. cout << "Enter the number k: ";
  8. cin >> k;
  9. cout << "\n";
  10. if(k>=2)
  11. {
  12. while(z<=k)
  13. {
  14. t = x;
  15. x = y;
  16. y = y + t;
  17. z = z + 1;
  18. }
  19. }
  20. cout << t;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement