Given a series of numbers that represent adding


C programming-NO USE OF ARRAYS

Problem: Given a series of numbers that represent adding fuel (2) and subtracting fuel (1), determine the longest distance that be traveled before running out of fuel.

• Your vehicle will always begin on the right side with no fuel.
• You may advance to the first 2 digit (from the right) as a starting point and from where you are able to travel two spaces (to the left).
• Each time your vehicle crosses another 2 the fuel tank is filled (to the capacity of 2)
• Each time your vehicle crosses a 1 your fuel tank decreases by 1.
• Your vehicle comes to a stop when it has no fuel and when the next digit to the left of its current position is a 1.

Input Validation:
• Your program must reject all negative input and all input that contains digits other than 1s and 2s.
• The user must be given an unlimited number of opportunities to enter valid data as input. 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Given a series of numbers that represent adding
Reference No:- TGS097111

Expected delivery within 24 Hours