code blocks power function is not working in c

前端 未结 5 844
陌清茗
陌清茗 2021-01-26 19:47

i am using code block for learning c. my code is

#include
#include
int main()
{
  int x;
  x = pow(5,2);
  printf(\"%d\", x);
}

Out         


        
5条回答
  •  甜味超标
    2021-01-26 20:51

    Your code correctly gives 25 on my windows x64.

    You probably needs to run it again see if you just read it wrong...
    The missing "return 0;" is not the problem here.

    If, anything, could ever go wrong,
    you can try adding

    fflush(stdin);//or out
    

    after very scanf and printf. If any of the flushes solves your problem, you know what is going wrong.

提交回复
热议问题