Answers for "Write a Program to find exponential without using pow() method"

0

Write a Program to find exponential without using pow() method

#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;
}
Posted by: Guest on July-31-2020

Code answers related to "Write a Program to find exponential without using pow() method"

Browse Popular Code Answers by Language