C Online Compiler
Example: C Program to Find Power of a Number using For loop
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C Program to Find Power of a Number using For loop #include <stdio.h> int main() { int base, exponent, result = 1; printf("Enter the Base & Exponent values:\n"); scanf("%d%d", &base, &exponent); // It will finding the power of Base value // by equiping Exponent value for (int i = 1; i <= exponent; i++) { result *= base; } printf("\nResult: %d^%d = %d\n", base, exponent, result); return 0; }
5 7
Output
Clear
ADVERTISEMENTS