C Program to Calculate the Power of a Number

Example
#include <conio.h>

#include <math.h>
#include <stdio.h>

void main()

{
int num, exp, res;
printf("Enter the number: ");
scanf("%d", &num);
printf("Enter exponent: ");
scanf("%d", &exp);


res = pow(num, exp);  // Calculating power using pow() function


printf("%d to the power %d is: %d", num, exp, res);
getch();
}
Program Output

Enter the number:

Enter exponent:

4 to the power 3 is: 64