This is the code I've worked on until now, when inputting large decimals, eg 8347.93, loop begins, any assistance to resolve this problem would be appreciated
#include <stdio.h>
int main(void) {
while (1) {
int client_id;
double bal;
char type, choice1;
double amount;
double deposit = 0;
double withdraw = 0;
printf("Enter the Client ID\n");
scanf("%d", &client_id);
printf("Enter the balance\n");
scanf("%lf", &bal);
while (1) {
printf("Enter the type of transaction\n'D' for deposit\n'W' for withdraw\n");
scanf("%c", &type);
if ((type == 'W') || (type == 'w')) {
printf("Enter the amount to withdraw: \n");
scanf("%lf", &amount);
withdraw = withdraw + amount;
bal = bal - amount;
}
else if ((type == 'D') || (type == 'd')) {
printf("Enter the amount to deposit: \n");
scanf("%lf", &amount);
deposit = deposit + amount;
bal = bal + amount;
}
else {
printf("Invalid input");
continue;
}
printf("If you want to do another transaction click 'Y'/'y' \n");
printf("If you want to exit, click 'N'/'n' \n");
scanf("%c", &choice1);
if ((choice1 == 'Y') || (choice1 == 'y')) {
continue;
}
else if ((choice1 == 'N') || (choice1 == 'n')) {
break;
}
else {
printf("Invalid Input");
}
}
printf("Total Amount Deposited = %lf\n", deposit);
printf("Total Amount Withdrawn = %lf\n", withdraw);
printf("Final Balance = %lf\n", bal);
printf("Client ID = %d\n", client_id);
//break;
}
return 0;
}