Question: 1. Given the switch statement as below: int x; cin >> x; switch(x % 3) { case 1: cout < < x ; break; case
1. Given the switch statement as below: int x; cin >> x; switch(x % 3) { case 1: cout << x ; break; case 2: cout << x + 2 << endl; break; default: cout << x/2 << endl; } Understand this switch statement and show what will be the output from this program segment for the following values of x: a) x = 20 b) x = 15 c) x = 1 d) x = 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
