168k views
2 votes
What is the result of the following java expression: 25 / 4 + 4 * 10 % 3

a. 19
b. 7.25
c. 3
d. 7

1 Answer

2 votes

The result of the expression is 7. Option D

Let's break down the expression following the order of operations (PEMDAS) which represents;

- Parentheses/Exponents, Multiplication and Division, Addition and Subtraction)

The expression is given as;

25 / 4 + 4 × 10 % 3

Then, we have that;

25/4 = 6 (integer division in Java truncates the decimal part).

4 ×10 = 40

40%3 equals 1 (the remainder when 40 is divided by 3).

Now, add the values, we get;

6 + 1 = 7

User Aakil Ladhani
by
7.2k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.