Dhruv Sb Dhruv Sb - 8 months ago 95
C++ Question

Power function is not working in c++

int n;
n = 2;
int d;
d = pow(10,n);

It displays 99 instead of 100.
I have indcluded math.h


Try using this code printf ("%f\n", d);. printf is come from stdio.h and is faster than cout. Also, change the type of d from int to double because pow return double