Browse Source

Refactoring: organize code to skip bad behavior

remotes/origin/feature/withdraw-money-system
Shivam Chaudhary 2 years ago
parent
commit
30e1fcfa9e
  1. 4
      src/withdrawMoney.c

4
src/withdrawMoney.c

@ -19,10 +19,10 @@ void withdraw(int user_id) {
float amountToWithdraw; float amountToWithdraw;
char tryDifferentAmount; char tryDifferentAmount;
float availableAccountBalance = getAvailableAccountBalance(user_id);
printf("Enter amount to withdraw: "); printf("Enter amount to withdraw: ");
scanf("%f", &amountToWithdraw); scanf("%f", &amountToWithdraw);
float availableAccountBalance = getAvailableAccountBalance(user_id);
if (amountToWithdraw > 0) { if (amountToWithdraw > 0) {
if (amountToWithdraw <= availableAccountBalance) { if (amountToWithdraw <= availableAccountBalance) {
initiateWithdraw(amountToWithdraw, availableAccountBalance); initiateWithdraw(amountToWithdraw, availableAccountBalance);

Loading…
Cancel
Save