power(using math.h function)
#include<stdio.h>
#include<math.h>
int main()
{
double base,exp;
printf("Enter base number: ");
scanf("%lf",&base);
printf("Enter power number: ");
scanf("%lf",&exp);
if(base==0&&exp==0)
{
printf("Math Error\n");
}
else
{
double power=pow(base,exp);
printf("%.3lf^%.3lf = %lf\n", base,exp,power);
}
return 0;
}
No comments:
Post a Comment