For input 12134 output is showing yes.but ishould be no. help me i am struck

int sum1=0,sum2=0;

You need to re-initialize these to 0 for every new test case, i.e inside the for loop.