Well, the user enters the number 3, and the while loop adds the user entered value to sum. Now the sum is equal to 3. Then, the user entered value is equal to itself minus 1, which is 2. Two is then added to sum again, which equals 3+2 or 5. The user entered value is again subtracted by 1. It now equals 1. That 1 is added to sum and the sum is equal to 6. The user entered value is subtracted by 1 and it finally equals 0. The loop stops running because value is equal to 0 and the sum, which is 6, is printed to the screen. 6 is the output.