148k views
3 votes
Consider the expression 3 * 2 ^ 2 < 16 5 AndAlso 100 / 10 * 2 > 15 - 3. Which operation is performed second?

1 Answer

3 votes

Answer:

In the first expression

3 * 4 will be performed second.

In the second expression

10* 2 will be performed second.

Step-by-step explanation:

In many programming language, there is an operator precedence where the operator (e.g. +, - , * , / etc) will be executed following a specific order. For example, the operator ^ which denotes power will always be executed prior to * or / and if / and * exist in the same expression, the operator positioned at the left will be executed first.

Hence, in the expression 3*2^2 < 16 , 2 will be powered to 2 (2^2) first and then only multiplied with 3.

In the expression 100 / 10 * 2 > 15 - 3, 100 will be divided by 10 and then only multiplied with 2.

User Gilsham
by
7.9k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.