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> // It will calculate the power of the base number long long FindPow(int b, int e) { long long r=1; while (e--) { r *= b; } return r; } // It's the driver function int main() { int b, x; // b - Base value, x - Exponent value printf("INPUT Base Number:: "); scanf("%d", &b); printf("\nINPUT Exponent Number:: "); scanf("%d", &x); // It will print the final output printf("\n\nOUTPUT:: %d^%d = %lld\n", b, x, FindPow(b, x)); return 0; }
4 5
Output
Clear
ADVERTISEMENTS