Ternary Operator Evaluation Problem – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2015-02A #JAVA#3959    siteicon   siteicon  

Problem Statement - Ternary Operator Evaluation Problem

Evaluate the value of n if the value of p=5, q=19
int n = (q-p) > (p-q) ? (q-p) : (p-q);

Solution

TC++ #3959

  Related (?) :

int n = (q-p) > (p-q) ? (q-p) : (p-q);
Since p-5 and q =19 we shall put values

(19-5) > (5-19) ? (19-5) : (5-19);

true ? 14 : when false;

n = 14;


Share

sunmitra| Created: 22-Mar-2018 | Updated: 16-Apr-2019|ICSE2015






Back