Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Print Patterns in PL/SQL

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

Input : 3
Output :
*
**
***

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

 

C




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
      DBMS_OUTPUT.PUT('*') ; -- printing *
    END LOOP;
    DBMS_OUTPUT.NEW_LINE; -- for new line
  END LOOP;
END;
--Program End


Output: 
 

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

 

My Personal Notes arrow_drop_up
Last Updated : 26 Feb, 2021
Like Article
Save Article
Similar Reads