codemaniacstudio

Write a program to enter P, T, R and calculate Simple Interest in PLSQL block.

Practical Practice 17

Oracle Practice

Write a program to enter P, T, R and calculate Simple Interest in PLSQL block.

Write a program to enter P, T, R and calculate Simple Interest in PLSQL block.

SOLUTION

--Static code

set serveroutput on;
DECLARE
   P NUMBER :=15000; 
   T NUMBER := 5; 
   R NUMBER(3,2) := 3.5; 
   SI NUMBER; 
BEGIN
       SI := (P * T * R) / 100;
      DBMS_OUTPUT.PUT_LINE('The Simple Interest is: ' || SI);
END;
/
    


--Dynamic code 
DECLARE
   P NUMBER :=&P; 
   T NUMBER := &T; 
   R NUMBER(3,2) := &R; 
   SI NUMBER; 
BEGIN
       SI := (P * T * R) / 100;
      DBMS_OUTPUT.PUT_LINE('The Simple Interest is: ' || SI);
END;
/

TRY IT YOURSELF

Exit mobile version