0
#include<stdio.h>
#include<math.h>

int main(){
    int num=10,i=2;

    num=pow(num,i);
    printf("%d",num);
    return 0;
}
kaylum
  • 13,155
  • 2
  • 21
  • 31
  • 1
    it will answer 99, using VS Code – Sumit Baloda Feb 16 '22 at 04:42
  • 4
    Maybe you should look at the pow signature..double pow(double x, double y); – G4143 Feb 16 '22 at 04:45
  • 1
    You can try using `powl` function. https://en.cppreference.com/w/c/numeric/math/pow – kiner_shah Feb 16 '22 at 04:52
  • 3
    (To be clear, it is not a problem with `pow()` — the problem is that you are truncating a floating point value.) – Dúthomhas Feb 16 '22 at 05:00
  • 1
    VS Code is not a compiler, but a text editor with IDE functionalities. Which compiler are you using? – Costantino Grana Feb 16 '22 at 07:07
  • [Why does pow(5,2) become 24?](https://stackoverflow.com/q/22264236/995714), [Why pow(10,5) = 9,999](https://stackoverflow.com/q/9704195/995714), [Why the result of pow(10,2) 99 instead of 100?](https://stackoverflow.com/q/54057687/995714) – phuclv Feb 16 '22 at 09:03

0 Answers0