From the question it is given that,
Number of students in a class = 40 students
1/5 of the total number of students like to eat rice only = 1/5 × 40
= 1 × 8
= 8 students
2/5 of the total number of students like to eat chapati only = 2/5 × 40
= 2 × 8
= 18 students
Then,
Number of students like to eat both = 40 – (8 + 16)
= 40 – 24
= 16 students
Fraction of the total number of students like to eat both = 2/5