# Write a C program to calculate the power of a number

Questions:

How to find power of a number in C programming language.

Write a program in C to calculate the power of a number using while loop.

#include#include void main(){ int pow,num,i=1; clrscr(); long int sum=1; printf(" \nEnter a number: "); scanf("%d",&num); printf(" \nEnter the power of number: "); scanf("%d",&pow); while(i<=pow){ sum=sum*num; i++; } printf(" \n%d to the power %d is: %ld",num,pow,sum); getch(); }

## Examples

For Example: Let the number be 5 and the power be 3, than according to the c program mentioned above to find the power of a number the output is 125.