Method-1:
======================================================================
Suppose Square have length and width of equal size .so area of Square =side*side
Input-let its side is a
Output-Area of the Square
Operation- Square_area=a*a
Code-
SQL> set serveroutput on;
SQL> declare
2 a number;
3 Begin
4 a :=20;
5 Dbms_output.put_line('Area of the Square='||a*a);
6 End;
7 /
Area of the Square=400
PL/SQL procedure successfully completed.
======================================================================
Method-2:
======================================================================
Input-Ask user to enter side of the square and store the result into third variable result.
Output- Area of the square
Operation- result=a*a
SQL> declare
2 a number;
3 result number;
4 Begin
5 a :=&a;
6 result:=a*a;
7 Dbms_output.put_line('Area of the Square='||result);
8 End;
9 /
Enter value for a: 10
old 5: a :=&a;
new 5: a :=10;
Area of the Square=100
PL/SQL procedure successfully completed.
======================================================================
Suppose Square have length and width of equal size .so area of Square =side*side
Input-let its side is a
Output-Area of the Square
Operation- Square_area=a*a
Code-
SQL> set serveroutput on;
SQL> declare
2 a number;
3 Begin
4 a :=20;
5 Dbms_output.put_line('Area of the Square='||a*a);
6 End;
7 /
Area of the Square=400
PL/SQL procedure successfully completed.
======================================================================
Method-2:
======================================================================
Input-Ask user to enter side of the square and store the result into third variable result.
Output- Area of the square
Operation- result=a*a
SQL> declare
2 a number;
3 result number;
4 Begin
5 a :=&a;
6 result:=a*a;
7 Dbms_output.put_line('Area of the Square='||result);
8 End;
9 /
Enter value for a: 10
old 5: a :=&a;
new 5: a :=10;
Area of the Square=100
PL/SQL procedure successfully completed.
No comments:
Post a Comment