HELP

i want to detect the level of fuel on my diesel tank,
I used the ultrasonic sensor hc-sr04.
And I want to divide my tank on ten level

Level distance <10cm serial.print 90%
Level distance <20cm serial.print 80%
Level distance <30cm serial.print 70%
Level distance <40cm serial.print 60%
Level distance <50cm serial.print 50%
Level distance <60cm serial.print 40%
level distance <70cm serial.print 30%
Level distance <80cm serial.print 20%
Level distance <90cm serial.print ALERT

How it works with my code

calc_volume.ino (630 Bytes)

Other than having 10 if statements, instead of one if statement and 9 else if statements, what is the problem?

Level distance <10cm serial.print 90%
Level distance <10cm serial.print 80%
Level distance <10cm serial.print 70%
Level distance <10cm serial.print 60%
Level distance <10cm serial.print 50%
Level distance <10cm serial.print 40%
Distance distance <10cm serial.print 30%
Level distance <10cm serial.print 20%
Level distance <10cm serial.print ALERT

You might want to reconsider the requirement.
I suspect that you copy/pasted one line and changed the percentages but forgot to change the distances.