Drilled into me by my suspiciously effeminate music teacher at my second Grammar school, (he did look a bit like Liberace).
The series of intervals of a major scale from the root are
one - one - half - one - one - one - half
whereby one is a whole tone (or two semitones) and half is a semitone.
When it gets difficult just remember that the ABC rule must/should ideally be adhered to, in other words, there are occasions when F or C must be written as E or B sharp respectively and the flattened scale counterpart which I'm also too brain failured at the moment to remember.
A good book, IMHO, is "The Musician's Guide to Reading and Writing Music" by Dave Stewart, no not that Dave Stewart - the other one, written "as an antidote to the dreadful, stuffy classicism that pervades the subject" a little pocket paperback, cheap, no, but very reasonably priced, written in a very amusing and down to earth fashion, absolutely ideal for the post war generation, often prone these days to brain failure and general physical and cranial decomposition, (speaking purely, solely and alone from my own experience, wishing to offend neither man nor animal, bird nor fly, fish nor nymph).
gruss nach Spanien - spike