Q. What is the value of tip after executing the following code snippet?

Code:
int meal = 5;
int tip = 2;
int total = meal + (meal>6 ? ++tip : --tip);
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) 6
πŸ’¬ Discuss
βœ… Correct Answer: (D) 6

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
659
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
96%
Success Rate