← Back to If Statements
Question 231
Withdraw From Balance
Withdraw From Balance
Read an account balance and then an amount to withdraw, both whole dollars. When the amount is larger than the balance print Insufficient funds; otherwise take the amount off the balance and print the new balance in the form Balance: <value>. Input: two lines, the balance then the amount, each an integer, no prompts. Output: one line. The refusing branch is written; add the else branch with its two lines.
Expected Output:
Balance: 70= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.