Next: Exercises
Up: Nested if and if-else
Previous: Multiple Choice Questions
if (speed > 30) fine = 50; else if (speed > 40) fine = 75; else if (speed > 50) fine = 100;Is this correct? What fine would it assign to a speed of 60 mph? If incorrect how should it be written?
if-else
statement that will assign a character
grade to a percentage mark as follows - 70 or over A, 60-69 B, 50-59 C,
40-49 D, 30-39 E, less than 30 F.