c program
c program
h>
#include <stdlib.h>
void displayMenu() {
printf("4. Exit\n");
int main() {
int choice;
float amount;
while (1) {
displayMenu();
if (scanf("%d", &choice) != 1) {
// If the input is not an integer, clear the buffer and ask again
continue;
}
// Handle the user's choice using a switch-case
switch (choice) {
case 1:
break;
case 2:
// Deposit money
if (scanf("%f", &amount) != 1) {
break;
if (amount > 0) {
balance += amount;
} else {
break;
case 3:
// Withdraw money
if (scanf("%f", &amount) != 1) {
break;
} else {
break;
case 4:
exit(0);
default:
return 0;