C Program To Raise Number To Power using Recursion
Learn How To Raise Number To Power in C Programming Language using Recursion Technique. It is important that we should know How A For Loop Works before getting further with this C Program Code Tutorial.
Example
23 = 8
C Program To Raise Number To Power with Recursion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<stdio.h> int power_recursion(int base_num, int pow_num) { if(pow_num == 0) return 1; else return (base_num * power_recursion(base_num, pow_num - 1)); } int main() { int base_num, pow_num; int result; printf("Enter the Number: \t"); scanf("%d", &base_num); printf("Enter the Power: \t"); scanf("%d", &pow_num); result = power_recursion(base_num, pow_num); printf("\nResult = %d\n", result); printf("\n"); return 0; } |
Also Read: C Program To Raise An Integer To Power using For Loop
Output

In case you get any Compilation Errors with this C Program To Raise Integer To Power of any other Integer or if you have any doubt about it, let us know about it in the Comment Section below.