Question

Write a switch statement that uses the colour of a swab sample of COVID testing vehicle...

Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer.                                                                                        

Colour

Message

Blue

“No virus”

Yellow

“Needs to be under observation”

Red

“Needs to be admitted in COVID ward”

Homework Answers

Answer #1

SOURCE CODE

#include<stdio.h>
int main()
{
int n;
printf("Chose Colour: \n1. Blue\n2. Yellow\n3. Red\n");
scanf("%d", &n);

switch(n)
{
case 1:
printf("No virus\n");
break;
case 2:
printf("Needs to be under observation\n");
break;
case 3:
printf("Needs to be admitted in COVID ward\n");
break;
default:
printf("Wrong Input\n");
}
return 0;
}

OUTPUT SCREENSHOT

Comment bellow if you have any doubts.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle...
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer.                                                                                         Colour Message Blue “No virus” Yellow “Needs to be under observation” Red “Needs to be admitted in COVID ward”
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle...
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer. Colour Message Blue “No virus” Yellow “Needs to be under observation” Red “Needs to be admitted in COVID ward”
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle...
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer.                                                                                         Colour Message Blue “No virus” Yellow “Needs to be under observation” Red “Needs to be admitted in COVID ward”
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle...
Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer.