Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Sunday 18 March 2018

patterns in plsql

 The following pattern represents P(5) as :  
* * * * * 
* * * * 
* * * 
* * 
*

Here you can change the value of i to print different sized patterns.

    
DECLARE i integer ; j integer; BEGIN

i := 5; ----change for different patterns
<<outloop>> LOOP j := i; <<inloop>> LOOP dbms_output.put('*'|| ' '); j :=j - 1; exit inloop when (j = 0); exit outloop when (i = 0); end loop inloop; dbms_output.put_line(' '); i := i - 1; end loop outloop; END;

No comments:

Post a Comment