a+b+c+d=100, a-c=5, so c=a-5 and a+b+c+d=a+b+a-5+d=100, 2a+b+d=105.
ab-cd is maximum when cd is as small as possible, and when ab is as large as possible. The smallest value for c=6 (because it's 5 smaller than a, which has to be positive).
The largest values for a and b are when d=1, so that 2a+b=104, and ab is maximum when 2a=b=104/2=52, making a=26 and b=52, when ab=1352. When a=26, c=21.
So a=26, b=52, c=21 and d=1 satisfy the conditions a+b+c+d=26+52+21+1=100, and ab-cd=1352-21=1331.
If a=26+h and b=52-2h then 2a+b=52+2h+52-2h=104 (d=1) as before but ab=(26+h)(52-2h)=1352-2h2 which is less than 1352, meaning that the product ab is smaller and that ab-cd would not be a maximum value. Only when h=0 would we have the maximum product 1352, whether h is positive or negative.
d=105-2a-b, so:
ab-cd=ab-(a-5)(105-2a-b)=ab-(105a-2a2-ab-525+10a+5b)=
2a2-115a+2ab-5b+525=1331 when a=26 and b=52.