输出结果有误

#include <stdio.h>
#include <windows.h>

double power(double n,int p);
int main(void)
{
double x, xpow;
int exp;
printf("Enter a number and the positive integer power");
printf("to which the number will be raised.Enter q");
printf("to quit. ");
while (scanf_s("%f%d", &x, &exp) == 2)
{
xpow = power(x,exp);
printf("%.3g to the power %d is %.5g ",x,exp,xpow);
printf("Enter next pair of numbers or q to quit. ");
}
printf("Hope you enjoyed this power trip--bye! ");
//system("pause");
return 0;
}
double power(double n, int p)
{
double pow = 1;
int i;
for (i = 1; i <= p; i++)
pow *= n;
return pow;
}

原文地址:https://www.cnblogs.com/huqi001/p/15047579.html