As per the given data
A task is completed by 30 persons in 4 days
we are supposed to find In how many days the same will be completed by 40 persons
Task is completed by 30 persons in 4 days, it mean
30 person does one fourth of the work in one day
1 person does
of the work in one day
So back to previous step,
work done by 40 person in one day =

Hence the number of days required to complete the work by 40 person =3