The following flow chart represents reading a switch and dep

The following flow chart represents reading a switch and depending upon the result performing some action. Figure 5. Code to test switch. Develop a draft program to perform the actions/implement the flow chart of figure 5.

Solution

#include <stdio.h>

int main() {

/* local variable definition*/

char port = \'B\';

switch(port){

Case \'A\':

printf(\"switch pressed!\ \");

break;

Case \'B\':

Case \'C\':

printf(\"switch is off\ \");

break;

default:

printf(\"innvalid port\ \");

}

printf(\"Your port is %c\ \",port);

return 0;

}

 The following flow chart represents reading a switch and depending upon the result performing some action. Figure 5. Code to test switch. Develop a draft progr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site