Factorial without the use of command.
Show older comments
function y = fact(x)
y = x;
while x
end
2 Comments
Stephen23
on 12 Sep 2017
@Mubarak Abdulla: this is not twitter, so do not put ugly and pointless # characters onto every tag. Today I changed them for you, but in future you can remember that the entire world does not consist of twitter.
Answers (1)
KSSV
on 12 Sep 2017
N = 5 ;
f = 1 ;
for i = 1:N
f = f*i ;
end
1 Comment
Walter Roberson
on 12 Sep 2017
... except converted to use a while loop.
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!