Viết câu lệnh rẽ nhánh tính: A = x^2+y^2 +1 Nếu x > hoặc bằng 0
Giải thích
Cách 1:
if (x >= 0) and (y >= 0)
then A:= sqr(x) + sqr(y) + 1 else A:= sqrt(x*y);
Cách 2:
if ( x < 0) and (y < 0)
then A:= sqrt(x*y) else A:= sqr(x) + sqr(y) + 1;
Cách 1:
if (x >= 0) and (y >= 0)
then A:= sqr(x) + sqr(y) + 1 else A:= sqrt(x*y);
Cách 2:
if ( x < 0) and (y < 0)
then A:= sqrt(x*y) else A:= sqr(x) + sqr(y) + 1;