#include <stdio.h>
int main() {
int iSelection = 0;
float fTransAmount = 0.0;
float fBalance = 100.25;
printf("1/tDeposit Funds/n");
printf("2/tWithdraw Funds/n");
printf("Enter your selection: ");
scanf("%d", &iSelection);
if (iSelection == 1) {
printf("/nEnter fund amount to deposit: ");
scanf("%f", &fTransAmount);
printf("/nYour new balance is: $%.2f/n", fBalance + fTransAmount);
}
if (iSelection == 2) {
printf("/nEnter fund amount to withdraw: ");
scanf("%f", &fTransAmount);
if (fTransAmount > fBalance)
printf("/nInsufficient funds/n");
else
printf("/nYour new balance is $%.2f/n", fBalance - fTransAmount);
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266408.html