Home » C Programs » C Program to Find Power of a Number

C Program to Find Power of a Number

C Program to find power of a number. The power of a number determines how many times it should be multiplied. The product of multiplying a number by itself is called power. What number is being multiplied is indicated by the base number. The exponent, which is a little number printed above and to the right of the base number, indicates the number of times the base number is multiplied.

Power of a Number in C

A number base is the amount of digits or combinations of digits used to represent numbers in a counting system. Any whole number greater than 0 can be used as a basis. The decimal system, sometimes known as base 10, is the most widely used number system for power in c programming.

Exponent Number in C Program

An exponent is a number or letter that is written above and to the right of the base in a mathematical statement. Power of a number in c this program will produce the result for exponent value in c program.

Long Keyword in C

A 64-bit two’s complement integer is the long data type. The signed long has a value of -263 at its lowest point and 263-1 at its highest point. 

You can express an unsigned 64-bit long with a minimum value of 0 and a maximum value of 264-1 with the long data type in Java SE 8 and later.

Predecrement Operator in C

Before utilising a variable in an expression, a pre-decrement operator is used to decrement its value. The value of the variable is first decremented and then utilised in an expression with the pre-decrement operator.

Format Specifier in C

During input and output, the format specifier is utilised. It’s a technique to notify the compiler what kind of data is in a variable when using scanf() or printf() to take input (). Percentages such as c, d, and f are some instances. Long integer values are represented using the percent ld format specifier. For printing the lengthy integer value contained in the variable, the printf() function is used. 

C Program to Find Power of a Number

//c program to find power of a number  
#include <stdio.h>
int main()
int base, exp;
long double value = 1.0;
printf("Enter a base number");
scanf("%d", &base);
printf("Enter an exponent");
scanf("%d", &exp);
while (exp != 0)
value *= base;
printf("Answer = %.0Lf", value);
return 0;


Enter a base number4
Enter an exponent5
Solution is 1024