Let the principal amount be \( p = x \) rupees, Time \( (n) = 2 \) years, Rate of interest \( (r) = 4\% \). The compound interest for 2 years: \[ = x\left(1+\cfrac{4}{100}\right)^2 - x \] \[ = x \times \cfrac{104}{100} \times \cfrac{104}{100} - x \] \[ = x \times \left(\cfrac{10816-10000}{10000}\right) \] \[ = \cfrac{816x}{10000} \text{ rupees} \] The simple interest for 2 years: \[ = \cfrac{x \times 2 \times 4}{100} \text{ rupees} \] \[ = \cfrac{8x}{100} \text{ rupees} \] \(\therefore\) According to the given condition: \[ \cfrac{816x}{10000} - \cfrac{8x}{100} = 40 \] \[ \cfrac{816x - 800x}{10000} = 40 \] \[ x = \cfrac{\cancel{40}5 \times 10000}{\cancel{16}} = 50000 \] \(\therefore\) The principal amount was 50000 rupees.