Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(){
- int x, a, y, z, t, k;
- x = 0; a = 0; y = 1; z = 0; t = 0;
- cout << "Enter the number k: ";
- cin >> k;
- cout << "\n";
- if(k>=2)
- {
- while(z<=k)
- {
- t = x;
- x = y;
- y = y + t;
- z = z + 1;
- }
- }
- cout << t;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement