The factorial of an integer ? is defined using the followingequation: ?! = ? ∗ (? − 1) ∗ (? − 2) ∗ … ∗ 2 ∗ 1 In combinatorics,permutations is the number of ways of selecting a subset of someelements such that the order matters. For example, there are 6permutations of letters A, B, and C. A B C ,A C B, B A C, B C A, CA B, C B A, The permutation of selecting ? elements from a set of ?elements can be calculated using the following equation: ?(?, ?) =?! (? − ?)! On the other hand, combinations is the number of waysof selecting a subset of some elements such that the order does notmatter. The combination of selecting elements from a set of melements can be calculated using the following equation: ?(?, ?) =( ? ? ) = ?! ?! (? − ?)! Instructions Add a section / cell in yourMATLAB m-file script for problem 3 that: • Prompts the user toenter integer ? between 2 and 12 (inclusive) o If the input isinvalid, displays an error message and prompt the user to tryagain, as many times as necessary (use a loop to accomplish thisinstead of terminating the program) • Prompts the user to enterinteger ? between 2 and ? (inclusive) o If the input is invalid,displays an error message and prompt the user to try again, as manytimes as necessary (use a loop to accomplish this instead ofterminating the program) • Determines and displays the following: o?! o ?(?, ?) o ?(?, ?) This program must use loops to calculate theresults – DO NOT use any pre-defined MATLAB functions related tofactorials, permutations, and/or combinations.