1. ## Is this possible

I have my program running just about the way I want it to but can't work out some final details.

Basically I want to run this loop while the acc does not = 9999

Code:
```//loop to gather account information
while(acc != 9999){//run loop while account number does not = 9999
acc = accno();
//break loop if acc = 9999
if(acc == 9999)
{
break;
}
//count account entries
bal = balance(); // balance function
pur = purchase(); // purchase function
pay = payment(); //payment function
cr = credit(); //credit function

interim = iendbal( bal, pur, pay, cr);

interest = accint(interim);

final = fendbal(interest, interim);

printfun(acc,bal,pur,pay,cr,interest,final);

totfeb = totfeb + final;
}```
But acc can only be between 1000 - 4000. How can I write another if statement to loop back to prompting for acc if the account number doesn't meet these conditions.

Edit: added a little more code for clarification.

2. Ok so, we can't see the closing brace, where does the loop end? And what is accno() doing...

I can foresee all kinds of problems...
For example: getting into the loop and acc never ending up at 9999 creating an infinite loop...

If your accno can only be in the range 1000 to 4000 ... your loop will never end. You need to find a better way of doing this.

3. I added a bit more hopefully to clarify a bit.

acc will eventually = 9999 because that it how the user will let the program know it is done entering information.

accno() is just asking for a number then returning the entered value, but I want it the value to only be able to be between 1000 and 4000 and if not I want it to ask for the number again until it is between 1000 and 4000

4. Oh my, you've programmed yourself into a very interesting corner here...

The right place to limit the range is in the accno() function where it's easy to loop until you've got what you want.
The loop however needs out of range values to exit.

You could add logic in your accno() function to the effect that
Code:
``` if((acc != 9999) && (acc <1000 || acc > 4000))