Code for voltage sensor

I've searched the web for the code to make my voltage sensor work. If you've struggled like me to find a working code, look no farther. This code is the simplest way to make the sensor work. The delay is very high on my code because I don't need it to update the voltage as fast. This is a charge regulator for a battery and 5 seconds to run the loop is as fast as I need it to be.

#include <Wire.h>
int val11;
float val2;

void setup()

{
pinMode(A0,INPUT);

Serial.begin(9600);

}

void loop()

{
val11=analogRead(0);

val2=val11/39.85;

Serial.print("Voltage: ");

Serial.println(val2,4);

delay(5000);

}

Maybe it would be shorter and simpler if the Wire library were not present.

Please remember to use code tags when posting code, thusly

const byte input pin = A0;
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.print("Voltage: ");
  Serial.println(analogRead(inputPin) / 39.85, 4);
  delay(5000);
}

Serial.println(val2, 4);

Displaying four decimal places is unrealistic with Arduino's 10-bit A/D and the 1:4 divider you seem to use.
ONE A/D value/step is 25mV with your code.

Serial.println(val2, 1); would match the current code.
Leo..