DECLARE
num NUMBER:='&Input_Number';
res NUMBER:=0;
BEGIN
WHILE(num>0)LOOP
res:=res+num;
num:=num-1;
EXIT WHEN num=0;
END LOOP;
DBMS_OUTPUT.PUT_LINE(res||' Is Total !');
END;
/
Enter value for input_number: 5
15 Is Total !
PL/SQL procedure successfully completed.
No comments:
Post a Comment