Gradient is another word for slope.
Slope = rise/run = (y2-y1)/(x2-x1)
So pick 2 points.
Let's do line A first.
(1,1) and (2,4)
slope = (1-4)/(1-2)
= -3/-1 = 3
The slope (aka gradient) of line A = 3.
Line B.
(0,5) and (1,1)
slope = (5-1)/(0-1)
= 4/-1
= -4
The slope (aka gradient) of line B = -4.