Question: (25 points) Answer the following questions. (15 pts) The program given below uses a switch-case statement. Re-write the program converting the switch-case statement into an

  1. (25 points) Answer the following questions.
    1. (15 pts) The program given below uses a switch-case statement.

Re-write the program converting the switch-case statement into an if-else statement.

#include

void main(){

int num;

scanf(%d,&num);

switch(num){

case 1:

num = num + 5;

break;

case 2:

case 4:

num = num * 2;

break;

case -1:

num = 0;

break;

default:

num = -1;

}

printf(The result is %d ,num);

}

  1. (10 points) (WHO) The age health scale of the world health organization is given below.

0 - 17 adolescents.(ergen)

18 - 65 teen.(gen)

66 79 middle aged.(ortayal)

80 - 99 old. (yal)

The age of a person is entered on the keyboard. Write main routine which does given procedure.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!