Language Matlab
(standard version)
| Date: | 04/20/05 |
| Author: | Bill Becker |
| URL: | n/a |
| Comments: | 1 |
| Info: | http://www.mathworks.com |
| Score: |
a href=http://www.mathworks.com>Click</a> for more information.
% MATLAB verion of 99 Bottles of beer
% by Bill Becker
function beer(n);
if nargin<1, n=99; end
for i=n:-1:1,
disp([int2str(i) ' Bottles of beer on the wall,'])
disp([int2str(i) ' Bottles of beer,'])
disp('Take one down and pass it around,')
if i>1, disp([int2str(i-1) ' Bottles of beer on the wall.']),end
end
disp('No more bottles of beer on the wall!')
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
I fixed this in my version, which is right now twice the length of yours. So there is a tradeoff for everything. But I will find a way to shorten it.