Computer Applications

A girl wanted to calculate the sum of two numbers stored as a and b multiplied by 7. Select the appropriate Java expression.

  1. a + b*7
  2. 7*a + b
  3. (a + b)*7
  4. a + 7*b

Java Operators

1 Like

Answer

(a + b)*7

Reason — To calculate the sum of two numbers stored as a and b multiplied by 7, we use parentheses to add a and b first, then multiply the result by 7. The correct expression is (a + b)*7.

Answered By

3 Likes


Related Questions