0

I am doing my homework and am having trouble finding the answer to one question. We are supposed to view the code below:

Consider the following selection statement where X is an integer test score between 0 and 100.

input X

if (0 <= X and X < 49)
output "you fail"

else if (50 <= X and X < 70)
output "your grade is" X
output "you did OK"

else if (70 <= X and X < 85)
output "your grade is" X
output "you did well"

else if (85 <= X and X < 100)
output "your grade is" X
output "you did great"

endif
output "how did you do?"

Then we have to answer the following question:

How many levels of nesting are there in this design?

I have all the other answers to this assignment, but I do not know what they mean by nesting. Can someone please help?

Thanks!!!

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by nickewus24
0

Say that your first else if has an if statement within it and then that if statement has yet another. This is nesting.
(not sure what language you're using so I'll keep it generic)

if ()

else if()
    if()
       if()
       else

else if()
etc.

You should be able to figure out the answer at this point.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.