Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int prob(int n)
- {
- unsigned int i,o;
- int xnprev,xnnext;
- xnprev = xnnext = 1;
- o = 2;
- for (i = 1; i <= n; i++)
- {
- xnnext = 3 * xnprev + 4 * o;
- xnprev = xnnext;
- o *= 2;
- }
- return(xnnext);
- }
- int main(void)
- {
- int h,k;
- scanf("%d", &k);
- h = prob(k);
- printf("%d", h);
- return 0;
- }
Add Comment
Please, Sign In to add comment