Skip to content

Instantly share code, notes, and snippets.

@sengupta
Created May 8, 2011 18:31
Show Gist options
  • Save sengupta/961576 to your computer and use it in GitHub Desktop.
Save sengupta/961576 to your computer and use it in GitHub Desktop.
The popular Fizz-Buzz program in Scilab.
// See http://en.wikipedia.org/wiki/Fizz_buzz
List = 1:100;
Fizz = find(modulo(List, 3) == 0);
Buzz = find(modulo(List, 5) == 0);
FizzBuzz = find(modulo(List, 3*5) == 0);
strList = string(List);
strList(Fizz) = "Fizz";
strList(Buzz) = "Buzz";
strList(FizzBuzz) = "FizzBuzz";
disp(strList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment