Solution :

For path $$iaf,$$
$$Q = 50\,cal$$
$$W = 20\,cal$$
By first law of thermodynamics,
$$\Delta U = Q - W = 50 - 20 = 30\,cal.$$
For path $$ibf$$
$$\eqalign{
& Q' = 36\,cal \cr
& W' = ? \cr
& {\text{or,}}\,W' = Q' - \Delta U' \cr} $$
Since, the change in internal energy does not depend on the path, therefore
$$\eqalign{
& \Delta U' = 30\,cal \cr
& \therefore W' = Q' - \Delta U' = 36 - 30 = 6\,cal. \cr} $$