Example(s):Palindrome, prime, armstrong, "linear search", reverse etc.
Example(s):1575, 1632, 1539 (Only one at a time)
Problem Statement - Output of a ternary operator operation
Write output of the following program using the ternary operation logic.
int a=10,b=23; int c=a>b?a=b:b=a;
Here looking into condition part of ternary operator a>b will be false as a is 10 and b is 23. Now based on operator rule the false past after the : operator will come into effect. This means that a will be copied to b (assignment operation always happens from right hand side copied to left hand side). Once this happens finally new value of b which is now 10 will be copied to c.