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
PL/SQL code to find factorial of a number entered by user
DECLARE
num number; factorial number; FUNCTION fact(x number) RETURN number IS f number; BEGIN f := 1; for i in 1..x loop f := f*i; end loop;RETURN f; END; BEGIN num:= &enter_number; -- to take input from user factorial := fact(num); dbms_output.put_line(' Factorial of '|| num || ' is ' || factorial); END;
No comments:
Post a Comment