Programming Code Center(PCC)
[C]

(PCC)::[How-to-write-C-Program-to-Calculate-the-Power-of-a-Number]::[c]

File Name : Power_of_Number.c

//Power of a Number Using the while Loop
#include <stdio.h>
int main() {
    int base, exp;
    long long result = 1;
    printf("Enter a base number: ");
    scanf("%d", &base);
    printf("Enter an exponent: ");
    scanf("%d", &exp);

    while (exp != 0) {
        result *= base;
        --exp;
    }
    printf("Answer = %lld", result);
    return 0;
}

Output :

Power_of_Number.jpg