factorl.m

来自「matlab code for new user to design any p」· M 代码 · 共 10 行

M
10
字号
function [x]=factorl(i)
%factorl(i) gives the factorial of the nearest integer to number 'i'
%'i' should be an integer so we will round it to the nearest one
x=round(i);
if x>2
   for j=x-1:-1:2
      x=x*j;
   end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?