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”
1
Expert's answer
2012-09-28T08:07:56-0400
#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; }
Comments
Leave a comment