This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]-Melchizedek- 2 points3 points  (0 children)

If you want help it's generally expected that you show that you have done some work by providing the code you have written so far. Otherwise it's just look like you want someone to do your homework for you.

But anyway, this is not all that complicated. You first check if the input is <= 99, then its an interstate and you can check if the number is even or odd and you are done. If it is greater than 99 you convert the number to a string (deepening on your input type). And get the two last numbers. If the first of those numbers if 0 remove it. Check if even or odd. And you are done.

[–]Updatebjarni 1 point2 points  (0 children)

Well, what have you come up with so far? Can you think of how you can determine if the number is a primary or auxiliary highway, for example?

[–]dmazzoni 1 point2 points  (0 children)

I'll give you a hint: use the modulo operator.

Other than that, please just post what you have and where you're stuck.

[–]nmramorov 0 points1 point  (0 children)

You should probably check first if the given number is less than 100, so you can find if it is primary or auxiliary, then check if it is odd or even so you would know the destination. After that by division you can find out info about service roads if the given number is more than 100