The answer depends on what you are converting from: binary, ternary, octal, hexadecimal ...
You can use one of the Math.max() methods, or the ternary operator, that is, one of the following: Math.max(a, b) a > b ? a : b
mnnk
Ternary.
9
write a c program to fine largest/smallest of 3no (using ?:ternary operator/conditional operator)
Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.
R = (A > B && A > C) ? A : (B > C) ? B : C; // parentheses not necessary - for clarity only
Conditional Operator- Its the only ternary operator in c/c++.- Its syntax is-(condition)?statement1:statement2;-Shruti Jain
Ternary operator
You could use an if, but the ternary operator is especially compact for this purpose: result = a > b ? a : b;
You can use the ternary operator, in an expression such as: result = a > b ? a : b; This is equivalent to: if (a > b) result = a; else result = b;
The conditional operator is also known as ternary operator. It is called ternary operator because it takes three arguments. The conditional operator evaluates an expression returning a value if that expression is true and different one if the expression is evaluated as false.Syntax:condition ? result1 : result2If the condition is true, result1 is returned else result2 is returned.
1. Member-of operator (.) 2. Pointer-to-member-of operator (.*) 3. Ternary condition operator (?:) 4. Scope resolution operator (::) 5. sizeof operator 6. typeid operator
Compare two numbers, a and b. If a is greater than b then return a, otherwise return b. In C, we can implement this algorithm using the ternary operator (?:), as follows: return a>b?a:b;
The only "special" operators in C++ are those that cannot be overloaded. That is; the dot member operator (.), pointer to member operator (.*), ternary conditional operator (:?), scope resolution operator (::), sizeof() and typeof().
0 1 and 2