方法1:

#include <stdio.h>
#include <math.h>
int main()
{
int i=4;
printf("%g",pow(-1,i));

}


方法2:
#include <stdio.h>

int main()
{
int i=4,f=-1;
while (i-->0)
f*=f;
printf("%d",f);

}

方法3:

#include <stdio.h>
double po(float a,float b)
{
if (b>1) {
return (po(a,b-1)*a);
}
else return a;
}
int main()
{

printf("%g",po(-1,4));

}

相关文章:

  • 2021-07-24
  • 2022-01-18
  • 2022-12-23
  • 2021-11-17
  • 2022-01-05
  • 2021-10-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案