Answer:
The program is given below with appropriate comments for better understanding
Step-by-step explanation:
1) LMC Program:
LDA A //Load A
SUB B //Subtract from A, B which is 0.
SKZ // skip next statement if A-B == 0 , which is A == 0 as B is zero.
JMP ENDIF // jump to ENDIF point if A not equal to 0, else this step is skipped.
OUT // some statement , not called if A != 0.
ENDIF LDA A // jump statement arrives here if A != 0.
HLT //HALT
2) LMC Program:
//input first number
INP
//store it at address 99
STA 99
//input second number
INP
//add it to value at 99
ADD 99
//store the resulting sum to 99
STA 99
//input third number
INP
//add the number to value at 99 address(which is the sum of first and second number)
ADD 99
//output sum
OUT
//halt
HLT