Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 245077

Submitted on 16 May 2013 by Binbin Qi

Correct

71Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
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);