fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int a,n,m,i,count=0;
  6.  
  7. scanf("%d",&a);
  8. scanf("%d",&n);
  9. for(m=1;m<=n;m++){int k=1;
  10. for(i=1;i<=m;i++){
  11. k*=a;
  12.  
  13.  
  14. }count=count+k;
  15. }
  16.  
  17. printf("%d",count);
  18.  
  19.  
  20.  
  21.  
  22.  
  23. // your code goes here
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5304KB
stdin
5 3
stdout
155