Write a PL/SQL program to print pyramid - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, October 5, 2017

Write a PL/SQL program to print pyramid

Print Pyramid Pattern

Program:

DECLARE

PROCEDURE reverse_pyramid(n NUMBER)
IS
chk NUMBER := 1;
sp NUMBER := (n/2)+1;
BEGIN
LOOP
FOR j IN REVERSE 1 .. sp
LOOP
dbms_output.put(' ');
END LOOP;

FOR i IN 1 .. chk
LOOP
dbms_output.put('*');
END LOOP;
dbms_output.new_line;
chk := chk +2;
sp := sp - 1;
EXIT WHEN chk > 10 ;
END LOOP;
END;


BEGIN
reverse_pyramid(10);
END;

Output:
*
***
*****
*******

*********

No comments:

Post a Comment