Steps of construction:
(i) Place the zero mark of the ruler at A.
(ii) Mark a point B at a distance 7.8 cm from A.
(iii) Again, mark a point C at a distance 4.7 from A.
By measuring BC, we find that BC = 3.1 cm.
Hence, we get the figure as shown: