More generally an ADC cannot measure anything higher than it's reference voltage. Anything higher will max out the ADC reading. In the case of the ATmega328p, that's 1023, which your formula will calculate to be 2.56 volts.
Thanks AWOL for replying me. @AWOL I did not understand what do you mean by 5V on the input pin? I am powering up mega2560 with USB i.e. 5V from laptop. I am using analog pin A0 and want to read its voltages after writing some input on that.
2nd: Can I use analogWrite on analog pins? as you can see that I used analogWrite(A0,128); because I need to apply varying voltages something around 2 V on A0 pin.
3rd: How I can implement some voltages which are continuously increasing from 0 to 2 volts?