Which one of the following is correct?
Enter the number which you need the square root of.
Enter the number of which you need the square root.
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
In general, yes you can end a sentence with a preposition, however some teachers/grammarians don't approve of it. Nevertheless, many native English speakers use prepositions at the end of sentences. It's a controversial subject for some.
Anyway, your examples are a bit awkward, and not very natural, although they would be understood. I would say if it's possible, then rewording is the way to deal with dangling prepositions.
Try this instead
Enter a number to calculate the square root that you need.
It is not universally agreed by grammarians that there should be a 'rule' about not ending a sentence with a proposition. Even if there is, it is often ignored or relaxed in modern times for informal communications. In emails, text messages, and notes to friends, it's perfectly fine. But if you're writing a research paper or submitting a business proposal and you want to sound very formal, or to avoid upsetting people (or teachers) who support the alleged 'rule', avoid ending sentences with prepositions.
It would appear that some people are determined to hold on to this rule, no matter how many times they are informed that it really isn’t one.
It is often alleged that Winston Churchill said, of the so-called 'rule', something like 'This is the sort of nonsense up with which I will not put', but it has been shown that he almost certainly didn't say it.
Note: enter, not 'entre', and 'the square root'.