# C Program to print Power of a number ## 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.

Ex:-

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

### Working:-

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:-

`#include<stdio.h> 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*=number         temp = temp * number;         --expo;     }     printf("power of a %d is %d",number, temp);    return 0;}`

### Output:-

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