expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
Exercise 5

Assume that income = 8 and expense = 6. What is the value of each of the following expressions?

a. income + expense * 2

b. income + 4 – expense / 2

c. (income + expense) * 2

d. income – 3 * 2 + expense

e. 4 * ((income – expense) + 2) + 10

Step-by-step solution
Verified
like image
like image

Step 1 of 6

Precedence and associativity of the operators:

The precedence and associativity of operators is given below:

Symbol

Name

Precedence

Associativity

=

Assignment

Lowest

Right-to-Left

+

Addition

Medium

Left-to-Right

Subtraction

Medium

Left-to-Right

*

Multiplication

Highest

Left-to-Right

/

Division

Highest

Left-to-Right


Step 2 of 6


Step 3 of 6


Step 4 of 6


Step 5 of 6


Step 6 of 6

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon