im new to while loops and programming in general and im supposed to create a program where the user will enter their starting balance and they can choose to deposit or withdraw a certain amount of money. With every transaction the program will display their new balance. I will also have to write the program so that if their balance is 0 they will see a message saying they dont have money and if its less than 0 to display they have no money and their overdraft. this is the program i have written so far but im still having a little bit of difficulty understanding the concept behind while loops. so when i run my program the while part doesnt run at all and im not sure if the rest of the program is right either.
balance = input('Enter your starting balance: ');withdraw = input('withdraw amount: ');deposit = input('deposit amount: ');while balance < 0 balance = balance - withdraw fprintf('You have an outstanding balance of %.2f dollars.', balance);endwhiledisp('end');
Best Answer