From the given 140 students, all even numbered students opted Mathematics \left(M\right),hence,thenumberofstudentsoptedMathematicsisM ≡ \left[\dfrac{140}{2}\right] = 70,where[x] denotes the greatest integer function of x.
Similarly, the students who opted Physics are P≡[3140]=46
And, the students who opted Chemistry are C≡[5140]=28
Similarly, the students who opted Mathematics and Physics are the numbers which are divisible by both 2 and 3 i.e. 6, and their number is \left[\dfrac{140}{6}\right] = 23</p><p>ThestudentswhooptedMathematicsandChemistryarethenumberswhicharedivisiblebyboth2 \text{ and } 5i.e.10,andtheirnumberis[10140]=14
The students who opted Physics and Chemistry are the numbers which are divisible by both 3 and 5 i.e. 15, and their number is \left[\dfrac{140}{15}\right] = 9</p><p>And,thestudentswhooptedallthethreesubjectsarethenumberswhicharedivisibleby2, 3 \text{ and } 5i.e.30,andtheirnumberis[30140]=4

Now, using
n(P∪C∪M)=n(P)+n(C)+n(M)−n(P∩C)−n(C∩M)−n(M∩P)+n(P∩M∩C)
=46+28+70−9−14−23+4
=102
Thus, 102 students have opted for atleast one of the three subjects.
Hence, number of students who did not opt for any of the three courses = 140 - 102 = 38 .