how to add power in c programming code example
Example 1: c power operator
result = (int) pow((double) a,i);
Example 2: fuction power in c
#include <stdio.h>
#include <math.h>
int main()
{
double base, power, result;
printf("Enter the base number: ");
scanf("%lf", &base);
printf("Enter the power raised: ");
scanf("%lf",&power);
result = pow(base,power);
printf("%.1lf^%.1lf = %.2lf", base, power, result);
return 0;
}