1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> int power(int x, int n) { if (n == 1) return x; return x * power(x, n - 1); } int main(void) { int result; result = power(2, 10); printf("2ÀÇ 10½ÂÀº %d ÀÔ´Ï´Ù\n", result); } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <stdio.h> int power(int x, int n) { if (n == 0) return 1; return x * power(x, n - 1); } int main(void) { int result; result = power(2, 10); printf("2ÀÇ 10½ÂÀº %d ÀÔ´Ï´Ù\n", result); } | cs |