My issue
Am I wrong in saying that this statement given as one of the answers is incorrect:
‘If 3X = 2Y, then the minimum amount to be paid is 3X.’
The assignment operator (=) is used instead of strict equality operator (==).
The statement is essentially saying:
if ((3 * X) = (2 * Y)) { // then amount to be paid is this }
but this expression cannot evaluate to true since it is syntactically incorrect, it can only throw a syntax error.
if X * 3 == 2 * Y then this is the minimum price since the prices are equal.
Please let me know if my understanding is correct or if I am seeing this in the wrong way.
Learning course: Logic Building in C
Problem Link: CodeChef: Practical coding for everyone