C Program to print Power of a number

power of number in c

Power of a number

In this program we will calculate the power of a number using C programming. We want to calculate the power of any given number so you need to multiply that particular number power of time.


  1. Let suppose number is 24 so we need to multiply with 4 times of 2. That is 2*2*2*2=16.
  2. Number is  53 so we need to multiply with 3 time of 5. That is 5*5*5=125


Step 1– Enter the base number, the number in which you just want to find the power of the number.
Step 2– Enter the exponential, the power of the number.
Step 3– Initialize while loop, while the exponential is not equal to zero.
     (i) do temp*number and store it in the temp.
     (ii) now reduce the exponential with -1.
Here you got the power of the number.
Step 4– Now print the temp variable.
Step 5- Stop.

c program to find power of number

C Program:-

int main()
//To initialize variables
int number, expo,temp = 1;

//To take user input
printf("Enter a base number: ");
scanf("%d", &number);
//To display Exponent
printf("Enter an exponent: ");
scanf("%d", &expo);
//use while loop when power is not equal to zero
while (expo != 0)
temp = temp * number;
printf("power of a %d is %d",number, temp);
return 0;


Enter a base number: 6
Enter an exponent: 4
power of a 6 is 1296