Home / Questions / Given the value of a variable, write a statement, without using if construct, which will produce the absolute value of the variable.
Explanatory Question

Given the value of a variable, write a statement, without using if construct, which will produce the absolute value of the variable.

👁 10 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

x = x < 0 ? -x : x ;