PL/SQL Program to Print Table of a Number
In this program you will learn to create pl/sql program to print table of a number using for loop.
PL/SQL Program to Print Table of a Number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | DECLARE num NUMBER; res NUMBER; BEGIN -- get user input DBMS_OUTPUT.PUT_LINE('Enter a number:'); num := # DBMS_OUTPUT.PUT_LINE('Multiplication Table of ' || num || 'is following :'); FOR i IN 1..10 LOOP res := num * i; DBMS_OUTPUT.PUT_LINE(num || ' x ' || i || ' = ' || res); END LOOP; END; / |
Output
Enter a number: 5
Multiplication Table of 5 is following:
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70
Check out our other PL/SQL programs examples