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
- (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 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);
}
- (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
Get step-by-step solutions from verified subject matter experts
