If the value of val is 3 1, then m = valm is 3 1, and m is a non-zero value, so the statement in {} after while(m) is executed, and the last sentence in braces is m/=10; So after executing 1 times, m becomes 3, and then 3 is brought into while(m), and m is still a non-zero value, so the statement in {} after while(m) is executed again, and then m becomes 0, and then 0 is brought into while(m), so m is false to exit the while(m) loop and execute the following if.