Given,
We have to form four-digit number using the digits 1,2,3&5
Now for number to be divisible by 15 we need to fix the last digit as 5 as ___5, so that number can be divisible by 5 and for divisibility by 3 the addition of all number should be divisible by 3,
So making cases where sum is divisible by 3 we get,
Case 1−1,1,2 {\text{as }1,1,2 & 5\text{ sum is divisible by }3}
So, total ways for case 1 is 3 ways,
Case 2-{5,1,1}\rightarrow 3\text{ways},{3,3,1}\rightarrow 3\text{ways}&{3,2,2}\rightarrow 3\text{ ways}
So, total ways for case 2 is 9 ways.
Case 3−5,3,2→6 ways
Case 4−5,5,3→3ways
So, adding all cases we get, 3+9+6+3=21 ways.