Help me in solving LBCC21 problem

My issue

My code

// Update the code below to solve this problem

#include <stdio.h>
int main() 
{
  int t;
  scanf("%d",&t); 
  while(t--)
  {
  int P,a,x,y,z;
  scanf("%d",&P);
    x=P%10;
    y=abs(P/100);
    z=(abs(P/10))%10;
    a=(x+y)-z;
    printf("%d\n",a);
   }
return 0;
}

Learning course: Solve Programming problems using C
Problem Link: CodeChef: Practical coding for everyone

@dorothy77
have corrected your code some logical mistakes.
include <stdio.h>
int main()
{
int t;
scanf(“%d”,&t);
while(t–)
{
int P,a,x,y,z;
scanf(“%d”,&P);
x=P%100;
y=P/100;
z=x+y;
if(z<=10)
printf(“%d\n”,z);
else
printf(“-1\n”);
}
return 0;
}