My output is right but test case is not passing why?

on compiling and testing i get the right output but while submitting it doesn’t pass the test case
can you tell me what is wrong in this code i have written?

@aryapandey194_31bab11b21ee53fb
in the if loop you are missing one task
diff=abs(a[i]-a[j])
which have to be done to update the diff every time
if(diff>abs(a[i]-a[j])){

                    x=min(a[i],a[j]);

                    y=max(a[i],a[j]);

                    diff=abs(a[i]-a[j]);

                }

this should be the if loop
it would work fine if your issue still exists let me know and if clear mark it as resolved and rate my experience

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.