{"id":18966,"date":"2021-08-29T15:12:58","date_gmt":"2021-08-29T09:42:58","guid":{"rendered":"https:\/\/python-programs.com\/?p=18966"},"modified":"2021-11-22T18:37:10","modified_gmt":"2021-11-22T13:07:10","slug":"python-program-to-compute-1-n","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-compute-1-n\/","title":{"rendered":"Python Program to Compute 1\/N!"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Calculate the Surface Area and Volume of a Hemisphere<\/a>
\nFactorial:<\/strong><\/p>\n

The product of all positive integers less than or equal to n is the factorial of a non-negative integer n, denoted by n! in mathematics:<\/p>\n

n! = n * (n – 1) *(n – 2) * . . . . . . . . . . 3 * 2 * 1.<\/strong><\/p>\n

4 != 4 * 3 * 2 *1= 24<\/p>\n

Given a number N<\/strong> and the task is to calculate the value of 1\/N!<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 4<\/pre>\n

Output:<\/strong><\/p>\n

The value of 1\/n! with given n value{ 4 } = 0.041666666666666664<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Number = 6<\/pre>\n

Output:<\/strong><\/p>\n

The value of 1\/n! with given n value{ 6 } = 0.001388888888888889<\/pre>\n

Program to Compute 1\/N! in Python<\/h2>\n

Below are the ways to calculate the value of 1\/N! :<\/p>\n