Calibrating a LDR sensor

Hello I am new to Arduino, I am using an Arduino Uno board, and I am trying to calibrate a LDR and show the output on a 7 segment display.

At normal conditions I want my display to show a value of 5, and when it's dark a value of 0; and when there's extra light to show a value of 9.

I need help in writing the code, can anyone help??

Send the voltage seen on LDR voltage-divider to the serial monitor.
What is the voltage displayed when the room is normal (your level 5) ?
What is the voltage displayed when the room is dark (your level 0)?
What is the voltage displayed when the room is in extra light (your level 9)?

Study "constrain" function.

OR

You could use:
if(voltage>123 && voltage <200)
{
//Print a number to your diplay
}
else if ( more ranges )
. . .

etc.

.

okay thanks!!

int output=map(input,0,1023,0,9);