Which one of the following is correct?
Enter the number which you need the square root of.
Or
Enter the number of which you need the square root.
Which one of the following is correct?
Enter the number which you need the square root of.
Or
Enter the number of which you need the square root.
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.
Ending a sentence with a preposition (Merriam-Webster)
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'.
Both (preposition used before 'which' and preposition used at the end of the sentence) are correct.
In a formal style we place the preposition before 'which'.
[ 'centre'(UK) and 'center'(US) are both correct. But 'entre' is not correct. It is 'enter'.
'the square root']