Semantyka i weryfikacja programów/Ćwiczenia 13: Różnice pomiędzy wersjami

Z Studia Informatyczne
Przejdź do nawigacjiPrzejdź do wyszukiwania
Sl (dyskusja | edycje)
Nie podano opisu zmian
Sl (dyskusja | edycje)
Nie podano opisu zmian
Linia 9: Linia 9:
}}
}}


  <math>{n\geq1}</math>
  <math>{\color{Red}\{n\geq1\}}</math>
  x := 1; y := 0;
  x := 1; y := 0;
  <math>\mathbf{while}\,</math> x <= n <math>\,\mathbf{do}\,</math>
  <math>\mathbf{while}\,</math> x <= n <math>\,\mathbf{do}\,</math>
   y := y + x;
   y := y + x;
   x := x + 1
   x := x + 1
  {}
  <math>\{\color{Green}y=\Sigma_{z=1}^{n}z}\}</math>


{{rozwiazanie||roz1|
{{rozwiazanie||roz1|}}
<div class="mw-collapsible mw-made=collapsible mw-collapsed"><div class="mw-collapsible-content" style="display:none">
<math>\{n\geq1\}</math>
x := 1; y := 0;
'''while''' <math>\{y=\frac{x\cdot(x-1)}{2}\, \land\, x \leq n+1\}</math> x <= n '''do'''
  <math>\{y=\frac{x\cdot(x-1)}{2}\, \land\, x \leq n+1\, \land\, x \leq n\}</math>
  y := y + x;
  x := x + 1
  <math>\{y=\frac{x\cdot(x-1)}{2}\, \land\, x \leq n+1\}</math>
<math>\{y=\frac{x\cdot(x-1)}{2}\, \land\, x \leq n+1\, \land\, x>n\}</math>
<math>\{y=\frac{n\cdot(n+1)}{2}\}</math>


<div class="mw-collapsible mw-made=collapsible mw-collapsed"><div class="mw-collapsible-content" style="display:none">




</div></div>
</div></div>
}}
 





Wersja z 16:22, 11 sie 2006

Zawarto¶æ

Weryfikacja programow

Ćwiczenie 1

{n1}
x := 1; y := 0;
𝐰𝐡𝐢𝐥𝐞 x <= n 𝐝𝐨
  y := y + x;
  x := x + 1
Parser nie mógł rozpoznać (błąd składni): {\displaystyle \{\color{Green}y=\Sigma_{z=1}^{n}z}\}}

Rozwiązanie


Zadania domowe

Ćwiczenie 1