Print Patterns in PL/SQL


You have given a number n then you have to print number a right-angled pyramid of *

Examples:

Input : 3
Output :
*
**
***

Input : 7
Output :
*
**
***
****
*****
******
*******
filter_none

edit
close

play_arrow

link
brightness_4
code

declare
  
    -- declare variable n,
    i and j-- of datatype number
        n number :
    = 7;
i number;
j number;
  
begin
      
    -- loop from 1 to n
    for i in 1..n
    loop
        for j in 1..i
        loop
              
            -- printing *
            dbms_output.put('*');
end loop;
  
        -- for new line
        dbms_output.new_line;
        end loop;
        end;
  
        --Program End

chevron_right


Output:

*
**
***
****
*****
******
*******


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.