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