# Answer to Question #15437 in C++ for zyrus

Question #15437

Write a C++ program that would input the base and power and display the result:

Example:

Base is 4 Power is 2 the answer is 16 42 = 16

Base is 2 Power is 5 the answer is 32 25 = 32

Base is 0 Power is any no. the answer is 0 08 = 0

Base is any no. Power is 0 the answer is 1 70 = 1

Base is 0 Power is 0 the answer is “Indeterminate” i.e.: 00 = “Indeterminate”

Example:

Base is 4 Power is 2 the answer is 16 42 = 16

Base is 2 Power is 5 the answer is 32 25 = 32

Base is 0 Power is any no. the answer is 0 08 = 0

Base is any no. Power is 0 the answer is 1 70 = 1

Base is 0 Power is 0 the answer is “Indeterminate” i.e.: 00 = “Indeterminate”

Expert's answer

#include <stdio.h>

#include <math.h>

int main()

{

double base=0;

double Power=0;

printf("Enter base: ");

scanf("%lf", &base);

printf("Enter power: ");

scanf("%lf", &Power);

printf( "%.1f to the power of %.1f is %.1f

",base,Power,pow(base,Power));

scanf("%d",&Power);

return 0;

}

#include <math.h>

int main()

{

double base=0;

double Power=0;

printf("Enter base: ");

scanf("%lf", &base);

printf("Enter power: ");

scanf("%lf", &Power);

printf( "%.1f to the power of %.1f is %.1f

",base,Power,pow(base,Power));

scanf("%d",&Power);

return 0;

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment