Answer:
The C code for the problem is given below
Explanation:
#include <stdio.h>
int main() {
int highwayNumber;
int primaryNumber;
scanf("%d", &highwayNumber);
if (highwayNumber >= 1 && highwayNumber <= 999) {
if (highwayNumber <= 99) {
if (highwayNumber % 2 == 0) {
printf("I-%d is primary, going east/west.\n", highwayNumber);
} else {
printf("I-%d is primary, going north/south.\n", highwayNumber);
}
} else {
primaryNumber = highwayNumber;
highwayNumber %= 100;
if (highwayNumber % 2 == 0) {
printf("I-%d is auxiliary, serving the I-%d, going east/west.\n", primaryNumber, highwayNumber);
} else {
printf("I-%d is auxiliary, serving the I-%d, going north/south.\n", primaryNumber, highwayNumber);
}
}
} else {
printf("%d is not a valid interstate highway number.\n", highwayNumber);
}
return 0;
}