COMPUTE X = A * B - C * D and COMPUTE X = (A * B) - (C * D) (a) Are not the same (b) Are same (c) Syntactically wrong (d) Will yield a run time error

This question is related to TCS Interview

Showing Answers 1 - 4 of 4 Answers

Mayuresh

  • Aug 22nd, 2006
 

Both are same here.Since the computation takes place based on precedence,here ' * ' has higher precedence over ' - 'therefore first A * B will be calculated and then C * D and finally second quantity will be subtracted from first . In second case exactly the same things are happening as ( ) has higher precedence over any of the operators.

  Was this answer useful?  Yes

JJ

  • Feb 7th, 2007
 

BOTH WILL WORK

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions