Consider the following C program code snippet that is used to compute the cost of a product based on various characteristics. char option = 'A'; char features = 'G'; int cost = 0; switch(option) { case 'A': cost = cost + 400; case 'M': cost = cost + 2000; switch(features) { case 'P': cost = cost + 300; case 'B': cost = cost + 200; break; default: cost = cost + 100; } break; case 'B': cost = cost + 100; break; default: cost = 0; } // Value of cost? What is the final value of the cost variable? Please type your response as an integer number without spaces, quotations, decimals, etc.
Consider the following C
char option = 'A';
char features = 'G';
int cost = 0;
switch(option)
{
case 'A': cost = cost + 400;
case 'M':
cost = cost + 2000;
switch(features)
{
case 'P': cost = cost + 300;
case 'B': cost = cost + 200;
break;
default:
cost = cost + 100;
}
break;
case 'B': cost = cost + 100;
break;
default: cost = 0;
}
// Value of cost?
What is the final value of the cost variable?
Please type your response as an integer number without spaces, quotations, decimals, etc.
Step by step
Solved in 2 steps with 1 images