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;
/

TRY IT YOURSELF

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.