Aufgabe 1

Gesucht ist ein WHILE-Programm, welches die Summe dreier Werte aus x_1, x_2 \, \text{und} \, x_3 berechnet.

x_0 := x_1+0; \\ \text{WHILE} \,  x_2 \neq 0 \, \text{DO} \\ \qquad  x_0 := x_0+1; \\ \qquad   x_2 := x_2−1 \\ \text{END} \\ \text{WHILE} \,  x_3 \neq 0 \, \text{DO} \\ \qquad  x_0 := x_0+1; \\ \qquad   x_3 := x_3−1 \\ \text{END}  

Aufgabe 3

Gegeben sei das GOTO-Programm P:

M1:  x4 := x1;
M2: if x4 = 0 goto 10;
M3: x5 := x2;
M4: if x5 = 0 goto 8;
M5: x3 := x3 + 1;
M6: x5 := x5 - 1;
M7: goto 4;
M8: x4 := x4 - 1;
M9: goto 2;
M10: x5 := x5 - 1
  1. Welche Funktion berechnet P?
  2. Geben Sie ein entsprechendes WHILE-Programm an.
f(n,m) = n*m

x4 := x1;
while x4 <> 0 do
  x5 := x2;
  while x5 <> 0 do
    x3 := x3 + 1;
    x5 := x5 - 1
  end;
  x4 := x4 - 1
end