diff --git a/src/withdrawMoney.c b/src/withdrawMoney.c index 130a49a..b3165d0 100644 --- a/src/withdrawMoney.c +++ b/src/withdrawMoney.c @@ -19,17 +19,17 @@ void withdraw(int user_id) { float amountToWithdraw; char tryDifferentAmount; - float availableAccountBalance = getAvailableAccountBalance(user_id); - printf("Enter amount to withdraw: "); scanf("%f", &amountToWithdraw); + + float availableAccountBalance = getAvailableAccountBalance(user_id); if (amountToWithdraw > 0) { if (amountToWithdraw <= availableAccountBalance) { initiateWithdraw(amountToWithdraw, availableAccountBalance); } else { printf("You don't have sufficient money to withdraw. Do you want to try different amount?\n[y]: Yes, any other key : exit"); - scanf(" %c", &tryDifferentAmount); + scanf("%c", &tryDifferentAmount); if (tryDifferentAmount == 'Y' || tryDifferentAmount == 'y') { withdraw(user_id); }