Ask Question
19 June, 18:02

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. 19 June, 21:13
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers