Asked by Tshepo Motsei
                Input in a number representing a car type, until the number 0 is
input. There are three types of cars: 1 = luxury, 2 = commercial, 3 =
sedan.
Count how many of each type there are and print out this total with a
message stating what type of car it is.
            
        input. There are three types of cars: 1 = luxury, 2 = commercial, 3 =
sedan.
Count how many of each type there are and print out this total with a
message stating what type of car it is.
Answers
                    Answered by
            oobleck
            
    int t[1..3]
int n=0
while (n≠0) {
read n
if(n<0) {print error}
else if (n <= 3) {
t[n]++
}
}
for (n=1..3) {
printf "There are %d cars of type %d.",t[n],n
}
    
int n=0
while (n≠0) {
read n
if(n<0) {print error}
else if (n <= 3) {
t[n]++
}
}
for (n=1..3) {
printf "There are %d cars of type %d.",t[n],n
}
                                                    There are no AI answers yet. The ability to request AI answers is coming soon!
                                            
                Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.