I know this is relatively simple, but I've been struggling with this.
I have a problem where I need to tell an airplane pilot how many times he will fill up and how much fuel he will have left after x amount of legs. We need to assume that everytime the plane reaches 5 gallons of fuel, the plane is refueled to full capacity.
Each trip burns 8 gallons of fuel.
The fuel capacity is 42 gallons.
The test case is 12 legs and the pilot will be left with 10 gallons. I am almost positve I need a for loop with i = 1:number of legs
I've tried for loops, while loops, and if statements and all I get is that there are -54 gallons left or it just infinitely runs.
Any amount of help would be appreciated.
Thanks,
Jack
Best Answer