Ask Question
17 September, 08:15

What will be the value of bonus after the following code is executed?

int bonus, sales = 6000;

if (sales < 5000);

bonus = 200;

else if (sales < 7500);

bonus = 500;

else if (sales < 10000);

bonus = 750;

else if (sales < 20000);

bonus = 1000;

else;

bonus = 1250;

A. 200

B. 500

C. 750

D. 1000

+4
Answers (1)
  1. 17 September, 08:35
    0
    Option (B) i. e., 500 is the correct option to the following question.

    Explanation:

    The following option is correct because here, firstly they defined two integer data type variable i. e., "bonus" and "sales" and assign value to the variable "sales" i. e., 6000 then, the set the if-else if statements to check the "bonus" and pass conditions is if the sales is less than 5000 then bonus is equal to 200 otherwise if the sales is less the 7500 then bonus is equal to 500 otherwise if the sales is less the 10000 then bonus is equal to 750 otherwise if the sales is less the 2000 then bonus is equal to 1000 otherwise bonus is equal to 1250.

    So, according to the following conditions sales is less than 7500 because sales is equal to the 6000 that's why the following option is correct.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What will be the value of bonus after the following code is executed? int bonus, sales = 6000; if (sales < 5000); bonus = 200; else if ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers