Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

exponent calculator

#include <math.h>
#include <stdio.h>

int main() {
    double base, exp, result;
    printf("Enter a base number: ");
    scanf("%lf", &base);
    printf("Enter an exponent: ");
    scanf("%lf", &exp);

    // calculates the power
    result = pow(base, exp);

    printf("%.1lf^%.1lf = %.2lf", base, exp, result);
    return 0;
}
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #exponent #calculator
ADD COMMENT
Topic
Name
8+4 =