Rectangular loop PQRS is placed near a long straight wire as shown.
l = PQ = RS = 25 cm = 0.25 m
b = QR = PS =10 cm = 0.10 m
r1 = 2 cm = 0.02 m,
r2 = 12 cm = 0.12 m

The currents in PQ and XY are antiparallel, so PQ is repelled away from wire XY. This repulsive force is

The currents in XY and RS are in the same direction, so wire RS is attracted towards wire XY. This attractive force is

The currents in PS and QR are equal and opposite. By symmetry they exert equal and opposite forces (F3 and F4) and hence net force on these sides is zero.
∴ Net force on rectangular loop
F = F1 – F2 (repulsive)
= 9.375 × 10–4 – 1.563 × 10–4
= 7.812 × 10–4 N (repulsive)
The net force is directed away from long wire XY.