fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a,b,c=2,d=1;
  5. scanf("%d\n",&b);
  6.  
  7. while(d<b){
  8. d=d+1;
  9. c=3*c;
  10. a=a+c;
  11. }
  12.  
  13. printf("%d\n",a);
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5320KB
stdin
4
stdout
78