What was this ?

Second question was pattern based. when n is odd, sum should be divisible by n for a ‘Yes’. If the n is even then: temp1=an+(n-1)(n)/2 and temp2=an+(n-1)(n). These are the sum of first n terms in the AP with common diff=1 and 2. Now (sum-temp1)%n or (sum-temp2)%n should be 0 for a ‘Yes’.

Can u explain the else part of your code .? How did u prove that positive solution to the equaiton exists

How many T-shirts will be sent?