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
if (a>b&&b>c) then largest number is:
A store has purchased some cola cans of various brands. It purchased 50 cans @ ₹15 per can, 30 cans @ ₹20 per can and 40 cans @ ₹21 per can. Write a Java program to compute how much amount did the store pay.