#include
#include<math.h>
using namespace std;
int main()
{
cout<<static_cast(pow(10,18)+999999999999999999);
return 0;
}
out put-2000000000000000000
#include
#include<math.h>
using namespace std;
int main()
{
cout<<static_cast(pow(10,18)+999999999999999999);
return 0;
}
out put-2000000000000000000
include
‘iostream’
pow() function return double type ans if you do double - integer so the result is double which is then converted into integer. Now the problem is that double has precision problem. So if you are dealing with large numbers, please use powl() instead of pow() and powl() will return long double type which whill solve your problem. And also is you wanna type 9999999999999999, please type LL at the end of it, like this 9999999999999999LL.