Develop an Mfile function to compute the factorial using a w
     Develop an M-file function to compute the factorial using a while...break loop structure. Your function should check to make sure the input argument is a non-negative integer scalar. Test your function to compute 5! and 9!  
  
  Solution
% MATLAB program to calculate factorial
x = input(\'Please enter the number\');
z=1;
If x<0
fprintf(\'This is not a valid input\');
else
while(1)
for y=1:x
z=y*z;
if y==x
break;
end
end
end
fprintf(\'Factorial=%d\',z);
end

