---
title: "Address-format code for Y=A/(B+C)+(D+E)*F"
subject: "Computer Organization and Architecture"
chapter: 2
key: "semester_5/computer_organization_and_architecture:address-code-4"
source: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/address-code-4
site: BCT Engineering
---

# Address-format code for Y=A/(B+C)+(D+E)*F

Computer Organization and Architecture · Chapter 2: Central Processing Unit

- Asked in: 2073 Chaitra, 8 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_organization_and_architecture/address-code-4
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_organization_and_architecture/chapter-2

## Question

Write codes using 3, 2, 1 and 0 address instruction formats to perform the operation Y = A/(B+C)+(D+E)*F.

## Short answer

Postfix form A B C + / D E + F * + yields 5 three-address, 9 two-address, 11 one-address and 12 zero-address instructions. Fewer addresses per instruction mean more instructions but shorter encoding.

## Answer

Assumptions: the operands are memory locations, `R1, R2, ...` are CPU registers, `T1, T2, ...` are temporary memory locations, and `Y` receives the result. Multiplication and division are done before addition and subtraction, and equal-priority operators go left to right.

Fully bracketed: **Y = (A/(B+C))+((D+E)*F)**. Postfix (reverse Polish) form: `A B C + / D E + F * +`.

#### Three-address instructions (OP dest, src1, src2)
```text
ADD R1, B, C   ; R1 = B + C
DIV R2, A, R1  ; R2 = A / R1
ADD R3, D, E   ; R3 = D + E
MUL R4, R3, F  ; R4 = R3 * F
ADD Y, R2, R4  ; Y = R2 + R4
```
Number of instructions: 5. Shortest program, but each instruction is long (three addresses).

#### Two-address instructions (OP dest, src; dest = dest OP src)
```text
MOV R1, A   ; R1 = A
MOV R2, B   ; R2 = B
ADD R2, C   ; R2 = R2 + C
DIV R1, R2  ; R1 = R1 / R2
MOV R2, D   ; R2 = D
ADD R2, E   ; R2 = R2 + E
MUL R2, F   ; R2 = R2 * F
ADD R1, R2  ; R1 = R1 + R2
MOV Y, R1   ; Y = R1
```
Number of instructions: 9. A MOV is needed first because the destination operand is overwritten.

#### One-address instructions (accumulator AC is the implied operand)
```text
LOAD B    ; AC = B
ADD C     ; AC = AC + C
STORE T1  ; T1 = AC
LOAD A    ; AC = A
DIV T1    ; AC = AC / T1
STORE T2  ; T2 = AC
LOAD D    ; AC = D
ADD E     ; AC = AC + E
MUL F     ; AC = AC * F
ADD T2    ; AC = AC + T2
STORE Y   ; Y = AC
```
Number of instructions: 11. Intermediate results that cannot stay in AC are saved in memory temporaries.

#### Zero-address instructions (stack machine)
```text
PUSH A  ; push A
PUSH B  ; push B
PUSH C  ; push C
ADD     ; pop two, compute, push result
DIV     ; pop two, compute, push result
PUSH D  ; push D
PUSH E  ; push E
ADD     ; pop two, compute, push result
PUSH F  ; push F
MUL     ; pop two, compute, push result
ADD     ; pop two, compute, push result
POP Y   ; Y = top of stack
```
Number of instructions: 12. Only PUSH and POP carry an address; ADD, SUB, MUL, DIV work on the top two stack items, so the program follows the postfix form directly.

**Summary:** 3-address = 5, 2-address = 9, 1-address = 11, 0-address = 12 instructions. Fewer addresses per instruction means shorter instructions but more of them.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. In Y = A/(B+C)+(D+E)*F, why is B+C computed before A is divided?
   A. Addition always comes before division
   B. Division is done last in any expression
   C. Brackets have priority, so B+C must be evaluated first
   D. A must first be added to B
   Answer: C. The bracket forces B+C to be computed first; A is then divided by that result. (Key point: Order of evaluation)

2. What is the postfix form of Y = A/(B+C)+(D+E)*F?
   A. A B C / + D E + F * +
   B. A B C + / D E + F * +
   C. A B + C / D E F + * +
   D. A B C + / D E F * + +
   Answer: B. B C + then A / gives A/(B+C); D E + F * gives (D+E)*F; a final + joins them. (Key point: Postfix form)

3. How many three-address instructions are needed for this expression?
   A. 5
   B. 3
   C. 6
   D. 9
   Answer: A. There are five operators (+, /, +, *, +), one instruction each. (Key point: Three-address count)

4. In one-address code, why are STORE Tn instructions needed in the middle of the program?
   A. To convert the expression to postfix form
   B. Because the ALU cannot add numbers directly
   C. To increase the number of addresses per instruction
   D. The accumulator is the only implied register, so an intermediate result must be saved in memory before AC is reused
   Answer: D. AC holds only one value; a partial result needed later has to be stored in a temporary memory location. (Key point: Temporaries in one-address code)

## Close variants set in other exams

- [Address-format code for Y=(A+B)*(C+D)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-7) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for X=(A*B/C)-(D+E/F)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-1) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for X=(P+Q)×(R+S)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-2) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=A*(B+D/C)+(G*E)/F](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-3) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=(A+B)*(C+D)+G/E*F](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-5) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for X=(A-B*F)*C+D/E](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-6) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=A/B+(C×D)+F(H/G)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-8) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=AB+(C/D)+E(F/G)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-9) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=(A-B+C)*(E+F/G)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-10) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=(A-B/C)×(D+E×G)/F](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-11) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=(A-B/C)*[D+(E*G)]](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-12) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=(W+X)*(Y-Z)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-13) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=(A+B)/C+D/(E*F)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-14) — Computer Organization and Architecture, chapter 2, asked 16×
- [Address-format code for Y=AB+(F/G)+CD](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-17) — Computer Organization and Architecture, chapter 2, asked 16×

## Related in Computer Organization and Architecture

- [Instruction fields and address formats for X=(E+F)*(G+H)](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Acode-fields-e-f-g-h) — Computer Organization and Architecture, chapter 2

## Related in other subjects

- [Instruction and data format, addressing modes](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3A8085-instruction-data-format-addressing) — Microprocessor, chapter 2, asked 2×
- [Datapath operation and instruction cycles](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Adatapath-operation-instruction-cycles) — Embedded System, chapter 2
- [Convolutional vs block codes; (7,4) cyclic code for 1011](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Aconv-vs-block-cyclic-7-4-1011) — Communication Systems, chapter 8, asked 2×
