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

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

Computer Organization and Architecture · Chapter 2: Central Processing Unit

- Asked in: 2078 Kartik, 8 marks
- Video: [Instruction Format | zero, one, two and three address instructions program | CAO | COA](https://www.youtube.com/watch?v=Htw_NTvj1ss) — Techno Tutorials ( e-Learning)
- 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-11
- 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×G) / F.

## Short answer

Y = (A-B/C)×(D+E×G)/F requires six three-address, eleven two-address, twelve one-address, and fourteen zero-address instructions. The zero-address code follows the postfix form directly; fewer addresses per instruction yield shorter instructions but a higher count.

## 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. The product and the division at the same level are done left to right: ((A - B/C) × (D + E×G)) / F.

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

#### Three-address instructions (OP dest, src1, src2)
```text
DIV R1, B, C    ; R1 = B / C
SUB R2, A, R1   ; R2 = A - R1
MUL R3, E, G    ; R3 = E * G
ADD R4, D, R3   ; R4 = D + R3
MUL R5, R2, R4  ; R5 = R2 * R4
DIV Y, R5, F    ; Y = R5 / F
```
Number of instructions: 6. 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
DIV R2, C   ; R2 = R2 / C
SUB R1, R2  ; R1 = R1 - R2
MOV R2, D   ; R2 = D
MOV R3, E   ; R3 = E
MUL R3, G   ; R3 = R3 * G
ADD R2, R3  ; R2 = R2 + R3
MUL R1, R2  ; R1 = R1 * R2
DIV R1, F   ; R1 = R1 / F
MOV Y, R1   ; Y = R1
```
Number of instructions: 11. 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
DIV C     ; AC = AC / C
STORE T1  ; T1 = AC
LOAD A    ; AC = A
SUB T1    ; AC = AC - T1
STORE T2  ; T2 = AC
LOAD E    ; AC = E
MUL G     ; AC = AC * G
ADD D     ; AC = AC + D
MUL T2    ; AC = AC * T2
DIV F     ; AC = AC / F
STORE Y   ; Y = AC
```
Number of instructions: 12. 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
DIV     ; pop two, compute, push result
SUB     ; pop two, compute, push result
PUSH D  ; push D
PUSH E  ; push E
PUSH G  ; push G
MUL     ; pop two, compute, push result
ADD     ; pop two, compute, push result
MUL     ; pop two, compute, push result
PUSH F  ; push F
DIV     ; pop two, compute, push result
POP Y   ; Y = top of stack
```
Number of instructions: 14. 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 = 6, 2-address = 11, 1-address = 12, 0-address = 14 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. How is (A-B/C) x (D+E x G) / F grouped at the final level?
   A. ((A-B/C) x (D+E x G)) / F
   B. (A-B/C) x ((D+E x G) / F)
   C. (A-B/C) x (D+E x G) x F
   D. A-(B/C) x ((D+E x G)/F)
   Answer: A. The product and division are at the same level and go left to right. (Key point: Left-to-right rule)

2. What is the postfix form of the expression?
   A. A B C / - D E G * + F / *
   B. A B - C / D E G * + * F /
   C. A B C / - D E G * + * F /
   D. A B C / - D E + G * * F /
   Answer: C. The two bracket results are multiplied first, then divided by F. (Key point: Postfix form)

3. How many three-address instructions are required?
   A. 5
   B. 6
   C. 7
   D. 12
   Answer: B. Six operators (/, -, *, +, *, /) give six instructions. (Key point: Three-address count)

4. In two-address code (OP dest, src), why is a MOV usually needed before an arithmetic instruction?
   A. Memory cannot be used as a source operand
   B. MOV makes the instruction shorter
   C. The ALU can only add values that were moved from memory
   D. The destination operand is overwritten by the result, so the first value must be copied into a register first
   Answer: D. In dest = dest OP src the destination is overwritten, so the original variable is copied into a register with MOV to keep it intact. (Key point: Why MOV in two-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+E)*F](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Aaddress-code-4) — 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)]](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×
