Viết câu lệnh rẽ nhánh tính:
\(a) \space z= \begin{cases}x^2+y^2 & nếu\space\space x^2+y^2 \leq 1\\ x+y & nếu \space\space x^2+y^2 > 1\space và\space y\geq x\\ 0,5 & nếu \space\space x^2+y^2 >1 \space và\space y < x \end{cases}\)
\(b)\space z=\begin{cases}|x|+|y| & Nếu\space điểm (x;y) \space thuộc \space hình \space tròn \space bán \space kính \space r (r > 0), \space tâm (a; b).\\x+y & Trong \space trường \space hợp \space còn \space lại\end{cases}\)
Viết câu lệnh rẽ nhánh:
a)
if sqr(x) + sqr(y)<= 1 then z:= sqr(x) + sqr (y)
else
if y >= x then z:= x + y else z:= 0.5;
b) if sqr (x-a)+sqr (y-b) <= sqr(r) then z:= abs (x)+abs (y) else z:= x + y;
-- Mod Tin Học 11