Problem 1200. FizzBuzz

Solution 495810

Submitted on 4 Sep 2014 by Aslak Grinsted
  • Size: 11
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% fname='FizzBuzz.txt'; out=FizzBuzz(fname); fid=fopen(fname); for i=1:100 if ~mod(i,15) v_exp='FizzBuzz'; elseif ~mod(i,5) v_exp='Buzz'; elseif ~mod(i,3) v_exp='Fizz'; else v_exp=num2str(i); end v=fgetl(fid); assert(strcmp(v,v_exp)) end fclose(fid);

ans = /users/msssytem8/FizzBuzz.txt

Suggested Problems

More from this Author246

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!