Python Program to Find the Factorial of a Number

Updated: May 18, 2020

Program to find the Factorial of a Number


num = int(input("Enter a number: ")) fact = 1 if num < 0: print("Sorry, factorial does not exist for negative numbers") elif num == 0: print("The factorial of 0 is 1") else: for i in range(1,num + 1): fact = fact*i print("The factorial of num is",fact)


Output:

Enter a number: 4 The factorial of num is 24



2 views0 comments

Recent Posts

See All

NIELIT CCC Exam January 2021 Practice Test Paper

Q. Bold, italic, underline are found in which menu in LibreOffice Writer? (A) Style (B) Format (C) Edit (D) Insert Ans: B Q. Intersection of row and column in Libreoffice Calc is called (A) Cell (B) T

NIELIT CCC Exam December 2020 Practice Test Paper

Q. The Extension of LibreOffice Writer is? (A) .odt (B) .ods (C) .odp (D) .docx Ans: A Q. The shortcut key for heading 3 in LibreOffice Writer is ? (A) Ctrl+1 (B) Ctrl+2 (C) Ctrl+3 (D) Ctrl+Shift+3 A

Flights from London to Krabi Info

The interesting vacationer hotel of Krabi is situated on the Western shore of Southeast Thailand. Many travellers head for amazing Phangnga Bay to appreciate standard water game activities such as

 

9555593818

Thakurdwara, Uttar Pradesh 244601, India

  • Facebook
  • Twitter
  • LinkedIn