I wrote pseudocode but don't know how to write it in Macthcad
Can you guys show me how would you write this in MATHCAD?
IF a>0 THEN
tol = 10^-5
x=a/2
DO
y=(x+a/x)/2
e=(y-x)/y
x=y
IF e<tol EXIT
END DO
SquareRoot=x
ELSE
SquareRoot=0
END IF
I wrote pseudocode but don't know how to write it in Macthcad
Can you guys show me how would you write this in MATHCAD?
IF a>0 THEN
tol = 10^-5
x=a/2
DO
y=(x+a/x)/2
e=(y-x)/y
x=y
IF e<tol EXIT
END DO
SquareRoot=x
ELSE
SquareRoot=0
END IF