Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int foo(int n)
- int result, last, i, tmp;
- {
- switch(n/1){
- case 2:
- result = n;
- case 1:
- if(n == 1){
- result = 1;
- }
- break;
- case 4:
- return 3;
- case 5:
- result = 5;
- default:
- last = 1;
- while(i < n){
- tmp = result;
- result = result + last;
- last = tmp;
- i++;
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement