In this tutorial, we will discuss the concept of Calculate power of a given number using recursion in C language
In this post, we will learn how to find the power of a given number using recursion in C language
Program 1
#include <stdio.h> #include <stdlib.h> int find_Power(int num1,int num2);//function prototype int main() { int base, powerValue, result; printf("Enter base number: "); scanf("%d",&base); printf("Enter power number: "); scanf("%d",&powerValue); result=find_Power(base,powerValue); printf("%d^%d=%d",base,powerValue,result); getch(); return 0; } int find_Power(int base, int powerValue)// { if(powerValue !=0) return (base*find_Power(base,powerValue-1)); else return 1; }
When the above code is executed, it produces the following results
Enter base number: 4 Enter the power number: 5 4^5=1024
Pow() pre-defined function is used to calculate the power of a number raised to a decimal value
Similar post
C++ program to find the power of a number using recursion
C program to find the power of a number using recursion
Java program to find the power of a number using recursion
Suggested for you
How to find reverse number using method In this article, we will discuss the concept…
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…