I am getting an error of "syntax error befor "else" " when i enter this code into the compiler:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
float Balance, creditDebit, newBalance;
printf("This is your checkbook balancing utility.\n");
printf("You will enter your current balance followed by\n");
printf("checkbook entries. Use + and - to indicate deposits\n");
printf("and withdrawals. Signal the end of processing by\n");
printf("entering a '0'\n");
printf(">>>Please enter your initial balance: ");
scanf("%f", &Balance);
printf("\n");
printf("Enter deposit (+) or Withdrawl (-): ");
scanf("%f", &creditDebit);
newBalance = Balance - creditDebit;
printf("Current balance: %.2f\n", newBalance);
if ( newBalance < 0)
printf("***I am sorry, you have bounced this check. $10 will be");
printf("deducted\n");
printf("Current balance: %.2f\n", newBalance - 10);
scanf("%.2f", &newBalance);
else if ( newBalance > 0)
printf("Current balance: %.2f\n", newBalance);
else if ( newBalance = 0)
printf("At end of program your final balance is: %.2f\n",
newBalance);
system("pause");
exit(0);
}
I am using cascaded if statements how my book shows me, am i maybe not understanding it correctly?
can anyone offer any help?