#include <stdio.h>
#include <stdlib.h>
int main() {
static float balance = 1000.0f;
float amount;
int choice;
do {
printf("Select your choice 1.Check Balance 2.Deposit 3.Withdrawal 4.Exit\n");
scanf("%d", &choice);
switch(choice) {
case 1:
printf("Your Current balance is: %.2f\n", balance);
break;
case 2:
printf("Enter Deposit Amount: ");
scanf("%f", &amount);
if(amount > 0) {
balance = balance + amount;
printf("Your Updated balance is: %.2f\n", balance);
} else {
printf("Transaction Failed!\n");
}
break;
case 3:
printf("Enter Withdrawal Amount: ");
scanf("%f", &amount);
if(amount <= balance && (balance - amount) >= 1000) {
printf("Withdrawal Successful.\n");
balance = balance - amount;
printf("Remaining Balance = %.2f\n", balance);
} else {
printf("Transaction Failed!\n");
}
break;
case 4:
exit(0);
default:
printf("Invalid Choice\n");
}
} while(1);
return 0;
}