My solution is marked as wrong. I checked for different test cases before submitting Code

@admin My Problem - “Chef and Polygon Cakes” and Problem Code “PCJ18C” and my solution Id is 19768167. Could you please give me the test cases where my solution failed.

I think some of your denominators values are wrong.
Are you getting any complier warnings?

You have a very strange style:

I recommend not using Macros where a simple function declaration will work.

Array elements are usually easier to read as A[i] rather than *(A+i), though both are right.

The last line of output usually has a ‘\n’ character at the end, like the others.

Using the trick to swap x and y is good to know, but bad to use if you expect someone else to read it.

For a test case, try

4
959 179 1
959 179 2
959 179 3
959 179 4

but the result you get may depend on your choice of compiler.

@john_smith_3 thanks John. I am not C Programmer. I am web developer in asp.net. During my graduation I used to be good C programmer. Your test case actually help me fix my issue. I just got to know about codechef. It may not be helpful for my career. But I want to explore my IQ in c program with others.