Practical Practice 13

Oracle Practice
Write a program to enter two angles of a triangle and find the third angle in PLSQL block.
Write a program to enter two angles of a triangle and find the third angle in PLSQL block.
SOLUTION
--Static code
DECLARE
angle1 NUMBER := 70;
angle2 NUMBER := 80;
angle3 NUMBER ;
BEGIN
angle3 := 180 - (angle1 + angle2);
DBMS_OUTPUT.PUT_LINE('The third angle of the triangle is ' || angle3 || ' degrees.');
END;
/

--Dynamic code
DECLARE
angle1 NUMBER := &angle1;
angle2 NUMBER := &angle2;
angle3 NUMBER ;
BEGIN
angle3 := 180 - (angle1 + angle2);
DBMS_OUTPUT.PUT_LINE('The third angle of the triangle is ' || angle3 || ' degrees.');
END;
/

--Dynamic code DECLARE angle1 NUMBER := &angle1; angle2 NUMBER := &angle2; angle3 NUMBER ; BEGIN angle3 := 180 - (angle1 + angle2); DBMS_OUTPUT.PUT_LINE('The third angle of the triangle is ' || angle3 || ' degrees.'); END; /