0

I have been given a program to write in java but inspite of thinking hard I have not been albe to get the logic for doing it.

Here's the problem-

I am given n dice which are rolled simultaneously and one of the possible sum of the dice. The program should return the no. of combinations in which that sum is possible with n dice. I really have no idea of the logic behind it.

Eg-

Suppose u have 2 dice and sum =8.

The program should return the no of combinations by which the sum 8 could appear.

In this case (6+2), (5+3), (4+4). total=3 combinations. (counting 6+2 and 2+6 as 1). They could also be counted separately.