Probability = (nr. of ways it can succeed) / (total nr. of possible outcomes)
The first cube can come up in 6 different ways. For each of those . . . The second cube can come up in 6 different ways. Total number of possible outcomes = 6 x 6 = 36 .
The toss succeeds if the sum is 5. How many ways can that happen ? 1 . . . 4 2 . . . 3 3 . . . 2 4 . . . 1 Four different ways.