C Program to calculate the power of a number

Problem

Write a program in C to calculate and display the power of a number.

How to calculate the power of a number in C ?

#include <stdio.h>
int main()
{
    printf("Abundantcode.com coding sample\n");
    int baseNumber, exponentNumber;
    long output = 1;

    printf("Enter the base number: ");
    scanf("%d", &baseNumber);

    printf("Enter an exponent: ");
    scanf("%d", &exponentNumber);

    while (exponentNumber != 0)
    {
        output *= exponentNumber;
        --exponentNumber;
    }

    printf("Answer = %ld", output);

    return 0;
}

Output

Abundantcode.com coding sample                                              
Enter the base number: 2                                        
Enter an exponent: 3                                             
Answer = 6