Evaluate the value of n if value of p = 5, q = 19
int n = (q – p) > (p – q) ? (q – p) : (p – q);
127 Likes
int n = (q – p) > (p – q) ? (q – p) : (p – q)⇒ int n = (19 - 5) > (5 - 19) ? (19 - 5) : (5 - 19)⇒ int n = 14 > -14 ? 14 : -14⇒ int n = 14 [∵ 14 > -14 is true so ? : returns 14]
Final value of n is 14
Answered By
71 Likes
Evaluate the given expression when the value of a=2 and b=3
b*=a++ - ++b + ++a; System.out.println("a= "+a); System.out.println("b= "+b);