👤

why I drop 1 of the result ?
when I use "float" or "double" to rez it works correctly. why?

#include
#include
using namespace std;

int main()
{
int a;
int rez;
cin>>a;
rez=pow(a,2);
cout<
}


Răspuns :

There is no pow(...) with 1st parameter integer, C++ uses a conversion to float or double, I can only guess which one. Do the conversion yourself, that's better.