Explanation:
so, what is the problem with the first one ?
you only need to put the specified values into the places of the variables and then simply calculate :
2×-5 + 8×6 = -10 + 48 = 38
that is how expressions, equations and functions work.
for the second, I am counting only the squares with their clear "majority" inside the line. any small parts of squares I ignore.
so,
first row : 3
second row : 5
third row : 5
fourth row : 6
fifth row : 7
sixth row : 7
seventh row : 4
eighth row : 2
total : 39