INPUT pins

The INPUT pins on my arduino uno shows a value of around 500 when nothing is connected to it.
I was using a photoresistor with arduino.

One pin was conected to 5v and other to A0. The constant read value at A0 was 1023.
The value is 0 when one pin of photoresistor is grounded and other still at A0.
Otherwise the value at every input is around 500.
Following is my code :

void setup() {
pinMode(A0,INPUT);
Serial.begin(9600);
}

void loop() {
double readValue;
double readVoltage;

readValue=analogRead(A0);
readVoltage = map(readValue,0,1023,0,5);

Serial.print("Read voltage is :");
Serial.println(readVoltage);
delay(200);
Serial.print("Read value is ");
Serial.println(readValue);
delay(200);
}

When nothing is connected to an input pin it is floating and could read any random value. This is normal and expected behavior.

void setup() {
 pinMode(A0,INPUT); // unnecessary
 Serial.begin(9600);
}

void loop() {
 double readValue; // analogRead does not return a double
 double readVoltage;
 
 readValue=analogRead(A0);
 readVoltage = map(readValue,0,1023,0,5); //map does not accept a double, nor does it return one.

 Serial.print("Read voltage is :");
 Serial.println(readVoltage);
  delay(200);
 Serial.print("Read value is ");// waiting 200 milliseconds does not affect the value you just printed.
 Serial.println(readValue);
  delay(200);
}

Please remember to use code tags when posting code

pinMode(A0,INPUT); // unnecessary but it acts as a reminder of what you are doing

It would be even better if you gave the pin a meaningful name