Calculate battery (18650 Li-ion) voltage using ESP8266-12E
Everything was correct and my circuit is also good. The only difference i found is to this below line:
temp = (analogvalue * 3.3) / 1024.0; 
Which should be
temp = (analogvalue * 1.0) / 1024.0;
We are multiplying because we are referencing the voltage from voltage divider circuit as 1 volt.
After doing this, i am getting the exact values battery voltage which then i convert to percentage.
Thank you!