C Program to find power of a number without inbuilt function
Program
#include<stdio.h>
void main()
{
int i, base, exponent, temp;
long power = 1;
printf("Enter base value:\n");
scanf("%d", &base);
printf("Enter exponent value:\n");
scanf("%d", &exponent);
temp = exponent;
while(temp != 0)
{
power *= base;
--temp;
}
printf("%d^%d = %d\n", base, exponent, power);
}
Output
Enter base value:
6
Enter exponent value:
3
6^3 = 216