>>it seems to get into a loop
You mean an infinite loop? :-) The reason is that you ask for and place a value in acct outside of the loop, so there's no way to exit the loop unless you ask for it inside the loop. The simple fix is to ask again :-)
Code:
#include<stdio.h>
int main()
{
int acct1;
float bal, chrg, cred, limit;
printf ("Enter in account number: (-1 to end)\n");
scanf ("%d", &acct1);
while(acct1!=-1){
printf ("Enter in begging balance:\n");
scanf ("%f", &bal);
printf ("Enter in total charges:\n");
scanf ("%f", &chrg);
printf ("Enter in total credits:\n");
scanf ("%f", &cred);
printf ("Enter in total credit limit:\n");
scanf ("%f", &limit);
printf ("Enter in account number: (-1 to end)\n");
scanf ("%d", &acct1);
}
bal = (bal+chrg)-cred;
if(bal>limit){
printf ("Account: %d\n", acct1);
printf ("credit limit: %.2f\n", limit);
printf ("balance: %.2f\n", bal);
printf ("credit limit exceded\n");
}
else
printf ("Enter in account number\n");
scanf ("%d", &acct1);
return 0;
}