fork download
  1. #include <stdio.h>
  2. int fung(int x, int y){
  3. int i;
  4. int sum=1;
  5. int c=1;
  6. for(i=1;i<=y;i++){
  7. c=c*x;
  8. sum=sum+c;
  9. }
  10. return sum;
  11. }
  12.  
  13. int main(void){
  14. int a,b;
  15. a=2;
  16. b=3;
  17. printf("%d", fung(a,b));
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
15