C Online Compiler
Example: C Program to Find Power of a Number using Function
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Find Power of a Number using Function #include <stdio.h> // This will find the power of a number void CalculatePower(int b, int e) { int r = 1; // by equiping Exponent value for (int i = 1; i <= e; i++) { r *= b; } printf("\nResult: %d^%d = %d\n", b, e, r); } // It's the driver code int main() { int base, exponent; printf("Enter the Base & Exponent values:\n"); scanf("%d%d", &base, &exponent); CalculatePower(base, exponent); return 0; }
9 5
Output
Clear
ADVERTISEMENTS