Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following code, (a) draw a flowchart and (b) write the equation for numz

ID: 3573493 • Letter: F

Question

For the following code, (a) draw a flowchart and (b) write the equation for numz with numx and numy, which the code tries to calculate (in other words, numz = f(numx, numy).

data prompti prompt numX numy numZ cod Main PROC redo end1 redo2 end2 maln END BYTE Enter the first number 0 BYTE Enter the second number 0 DWORD DWORD DWORD mov EDX OFFSET prompti al write string call Read Dec mov numX EAX mov ED OFFSET prompt2 al write string all Read Dec mov numy EAX EAX, um IMOV mov BX numy cmp BX,1 je end mul numX sub BX 1. jmp redo numZ, EAX IMOV mov EAX, num mov BX numX cmp BX 1. je end2 mul numy sub BX 1 Jmp redo2 add numZ EAX exit ENDP all

Explanation / Answer

Pseudo code:

Detailed Algorithm:

Step 1: Input N

Step 2: Sum = 0

Step 3: While (N != 0)

                        Rem = N % 10;

                        Sum = Sum + Rem;

                        N = N / 10;

Step 4: Print Sum