There are four different scenarios for calculating the LTCG:
Case 1:When market price on Jan 31 is more than the cost of acquisition, but less than the sale price: Let's say the shares are bought for Rs 200, fair market price is Rs 400 and the shares are sold for Rs 500. As the actual cost of acquisition is less than the fair market value as on January 31, the latter value will be taken as the cost of acquisition which is Rs 400. Hence capital gain is Rs 500-Rs 400= Rs 100.
Case 2:When market price on Jan 31 is more than cost of acquisition and sale price: The shares are bought for Rs 200 and the market price on January 31 is Rs 400, while the selling price of shares is Rs 300. Now the cost of acquisition is less than the market price on January 31, but the selling price is also less than the market price. So, the sale value will be taken as the cost of acquisition. So, cost of acquisition will be Rs 400. The long term capital gain is Rs 400-Rs 400= 0.
Case 3:When market value on Jan 31 is lower than cost of acquisition: When shares are bought for Rs 200 in early January, and sold for Rs 300 on April 15, but the market price is Rs 100, less than the cost of acquisition. In such a case, the cost of acquisition is Rs 200 and not the market price. The long term capital gain is this case would be Rs 300 - Rs 200 = Rs 100
Case 4:When sale price is less than both cost of acquisition and market price: Let's say the shares were bought for Rs 200 and the market price rises to Rs 400 but the sale price on April 21 is less than both these prices. The shares are sold for say Rs 100. In this case, the long term capital gain is Rs 100-200 = (-) Rs 100, which is the long term capital loss.