\relative is LilyPond’s most common pitch entry mode. You write note names and LilyPond picks the octave closest to the previous note.

Write an ascending C major scale — eight quarter notes from middle C up to the C above.

LilyPond manual reference

Target

Your Result

Click Check to compile and compare