Author Topic: Fizz Buzz Coding Quiz  (Read 4809 times)

0 Members and 1 Guest are viewing this topic.

Offline dimamantra

  • Thread Starter
  • Posts: 137
  • | (• ◡•)| (❍ᴥ❍ʋ)
Fizz Buzz Coding Quiz
« on: Fri, 22 May 2015, 01:55:55 »
One of my friends told me about this developer interview question and asked me to write a program. I had a lot of fun doing it. My answer is written in Python. I'm curious what you guys will reply with.

The rules are pretty simple.

I am going to give you an array of numbers: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

You need to write a script that will output this array of numbers either sequentially, or all at once in an array. For each number in the array that is divisible by 3, replace the number with "Fizz" and for each number that is divisible by 5, replace the number with "Buzz"

There really are no requirements after that.

So heres the deal - I've put my program here and if you are down to play...don't look at it!!!!
Post your responses in the language of your choice!
  :p :p :p :p :p


the_list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
def fizzbuzz(array):
   output = []
   for i in array:
      if i % 3 == 0:
         output.append('Fizz')
      elif i % 5 == 0:
         output.append('Buzz')
      else:
         output.append(i)
   return output
print fizzbuzz(the_list)


EDIT: Spelling cuz I'm dumb
« Last Edit: Fri, 22 May 2015, 10:51:10 by dimamantra »

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #1 on: Fri, 22 May 2015, 02:32:13 »
has anyone ever been asked this in an interview?  i don't understand how someone could be qualified and fail at the same time :/

EDIT:

i'm just going to leave you guys to indent this because i don't want anymore indenting wars mkay

; (function (ns) {
ns.runFizzBuzz = function (data) {
//TODO fix magic strings and put them into an enum
var isArray = Object.prototype.toString.call(data) === '[object Array]';

//GUARD: do not allow non-arrays
//TODO consider auto-wrapping non-arrays as arrays
if (!isArray) {
return "The test data must be formatted as an array";
}

//TODO consider how to handle cases where not each array item is a valid number

//TODO should be rewritten in a functional programming manner
var dataLength = data.length;
for (var g = 0; g < dataLength; g++) {
var currentItem = data[g];

//GUARD: do not allow null or undefined values
if (currentItem === undefined || currentItem === undefined) {
return "The test data has null or undefined values; processing was stopped";
}

//TODO ask interviewer how to handle cases where an item is both divisible by 3 and 5
if (currentItem % 3 === 0) {
data[g] = "Fizz";
} else if (currentItem % 5 === 0) {
data[g] = "Buzz";
}
}

return data;
};   
})(window.interviewTestAnswers = window.interviewTestAnswers || {});


var fizzBuzzData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
window.interviewTestAnswers.runFizzBuzz(fizzBuzzData);

console.log(fizzBuzzData );

and for the love of god, don't write something this overengineered without asking your interviewer first

« Last Edit: Fri, 22 May 2015, 03:08:44 by tbc »
ALL zombros wanted:  dead or undead or dead-dead.

Offline Findecanor

  • Posts: 5036
  • Location: Koriko
Re: Fizz Buzz Coding Quiz
« Reply #2 on: Fri, 22 May 2015, 05:59:29 »
The assignment said "output", so there (also in Python):
Code: [Select]
>>> for x in range(1,20+1):
...     if x % 3 == 0: print "Fizz"
...     elif x % 5 == 0: print "Buzz"
...     else: print x

Is the point of the interview question that the subject should ask what to do at number 15?
« Last Edit: Fri, 22 May 2015, 06:03:43 by Findecanor »

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: Fizz Buzz Coding Quiz
« Reply #3 on: Fri, 22 May 2015, 06:01:57 »
Bah.  That's not only over-engineered, it's unreadable.  You want some nice clean functional code.
Code: [Select]
(map
 (lambda (x)
   (format "~a~a," x
           (case x
             ((3 6 9 12 18 21 24 27 33 36 39 42 48 51 54 57 63 66 69 72 78 81 84 87 93 96 99) " Fizz")
             ((5 10 20 25 35 40 50 55 65 70 80 85 95) " Buzz")
             ((15 30 45 60 75 90) " Fizz Buzz")
             (else ""))))
 (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100))
More
I actually did it properly in order to get the lists of numbers :)

Offline SpAmRaY

  • NOT a Moderator
  • * Certified Spammer
  • Posts: 14667
  • Location: ¯\(°_o)/¯
  • because reasons.......
Re: Fizz Buzz Coding Quiz
« Reply #4 on: Fri, 22 May 2015, 06:46:10 »

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #5 on: Fri, 22 May 2015, 09:25:42 »
Bah.  That's not only over-engineered, it's unreadable.  You want some nice clean functional code.
Code: [Select]
(map
 (lambda (x)
   (format "~a~a," x
           (case x
             ((3 6 9 12 18 21 24 27 33 36 39 42 48 51 54 57 63 66 69 72 78 81 84 87 93 96 99) " Fizz")
             ((5 10 20 25 35 40 50 55 65 70 80 85 95) " Buzz")
             ((15 30 45 60 75 90) " Fizz Buzz")
             (else ""))))
 (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100))
More
I actually did it properly in order to get the lists of numbers :)

what does ~a~a do?

EDIT:

when someone explains how my version works, i will put up anther version ;)

« Last Edit: Fri, 22 May 2015, 09:35:32 by tbc »
ALL zombros wanted:  dead or undead or dead-dead.

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: Fizz Buzz Coding Quiz
« Reply #6 on: Fri, 22 May 2015, 10:11:58 »
what does ~a~a do?
It's a format string, a bit like C's printf() uses. And it's not necessary, as I copied my code from where I'd posted it elsewhere - it doesn't actually meet the requirements.  This version does it more strictly.

Code: [Select]
(map
  (lambda (x)
    (case (x)
      ((3 6 9 12 18) 'fizz)
      ((5 10 20) 'buzz)
      ((15) '(fizz buzz))     
      (else x)))
 (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20))
when someone explains how my version works, i will put up anther version ;)
Puts a function into a namespace object (interviewTestAnswers) under the window, and then calls it with the data.  That function is horrible, in that it mutates the data passed to it, and fails on fizz buzz.  I can't see why you're testing type and value equality against undefined twice, either.
« Last Edit: Fri, 22 May 2015, 10:15:16 by tufty »

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #7 on: Fri, 22 May 2015, 10:31:31 »
Puts a function into a namespace object (interviewTestAnswers) under the window, and then calls it with the data.  That function is horrible, in that it mutates the data passed to it, and fails on fizz buzz.  I can't see why you're testing type and value equality against undefined twice, either.

haha that is a typo -_-  should be a === null in there.

so why check for either?

because if i do !currentItem, then it will fail on 0.

about the array, there's a few things you didn't read in the OP:

1.  he said 'this' array, rather than an array.  There is only one array in this context.  (given ambiguity, i choose to be differenr here because some other factors are also different)
2.  "fizz buzz" isn't mentioned at all in the OP (and looking at his solution, not in the code either)


« Last Edit: Fri, 22 May 2015, 10:40:18 by tbc »
ALL zombros wanted:  dead or undead or dead-dead.

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: Fizz Buzz Coding Quiz
« Reply #8 on: Fri, 22 May 2015, 10:36:26 »
It actually doesn't say anything about outputting fizz or buzz either - you are to, and I quote, "output this array of numbers" :)

Offline nmur

  • ಠ_ಠ
  • Posts: 1539
  • Location: Sydney
Re: Fizz Buzz Coding Quiz
« Reply #9 on: Fri, 22 May 2015, 10:39:08 »
has anyone ever been asked this in an interview? 

I've had two software engineering jobs (including my current job). The first of which required me to write programs to solve three problems/tasks. All three we significantly harder than a fizzbuzz though, which would make sense because producing a fizzbuzz program should hopefully be trivial for most professionals. But I can see the use of it if interviewer wanted to purely assess coding style.

That being said, my current programming job interviews (for a fortune 100 company) didn't involve any code at all...

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #10 on: Fri, 22 May 2015, 10:42:01 »
It actually doesn't say anything about outputting fizz or buzz either - you are to, and I quote, "output this array of numbers" :)

ah, but you see?

this is why the original array is mitated.  my answer will always be included even if the interviewer uses a clever driver ;). as long as not too clever.
ALL zombros wanted:  dead or undead or dead-dead.

Offline dimamantra

  • Thread Starter
  • Posts: 137
  • | (• ◡•)| (❍ᴥ❍ʋ)
Re: Fizz Buzz Coding Quiz
« Reply #11 on: Fri, 22 May 2015, 10:50:02 »
The assignment said "output", so there (also in Python):
Code: [Select]
>>> for x in range(1,20+1):
...     if x % 3 == 0: print "Fizz"
...     elif x % 5 == 0: print "Buzz"
...     else: print x

Is the point of the interview question that the subject should ask what to do at number 15?

This is closest to what I did and it is short, sweet, and to the point.

I, however, appended to an empty list and then returned the whole list :p Unneeded...yes.


Offline dimamantra

  • Thread Starter
  • Posts: 137
  • | (• ◡•)| (❍ᴥ❍ʋ)
Re: Fizz Buzz Coding Quiz
« Reply #12 on: Fri, 22 May 2015, 10:53:24 »
has anyone ever been asked this in an interview? 

I've had two software engineering jobs (including my current job). The first of which required me to write programs to solve three problems/tasks. All three we significantly harder than a fizzbuzz though, which would make sense because producing a fizzbuzz program should hopefully be trivial for most professionals. But I can see the use of it if interviewer wanted to purely assess coding style.

That being said, my current programming job interviews (for a fortune 100 company) didn't involve any code at all...

Could you post your 3 challenges? I'm about 1 year into my first stint with programming and I'm hungry for bran twisters!

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #13 on: Fri, 22 May 2015, 10:58:57 »
has anyone ever been asked this in an interview? 

I've had two software engineering jobs (including my current job). The first of which required me to write programs to solve three problems/tasks. All three we significantly harder than a fizzbuzz though, which would make sense because producing a fizzbuzz program should hopefully be trivial for most professionals. But I can see the use of it if interviewer wanted to purely assess coding style.

That being said, my current programming job interviews (for a fortune 100 company) didn't involve any code at all...

sheer curiosity, is it CS algo questions that you got tested on or more common problem solving?

i'm told that people fail fizzbuzz because they get nervous...rly?...

EDIT:

after thinking about this some more...i only see this being useful if someone could write both the simplified version AND the complex production-ready version.
« Last Edit: Fri, 22 May 2015, 11:01:06 by tbc »
ALL zombros wanted:  dead or undead or dead-dead.

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: Fizz Buzz Coding Quiz
« Reply #14 on: Fri, 22 May 2015, 11:02:48 »
Okay then , here goes.  Scheme doesn't have arrays, but it does have vectors, which are more or less the same thing.  I believe I get bonus points for abusing logic operators for flow control :)

Code: [Select]
(define (fizzbuzz x)
  (or
    (and
      (vector? x)
      (begin
        (display x)
        (for-each
          (lambda (y)
            (cond
              ((zero? (mod (vector-ref x y) 3)) (vector-set! x y 'fizz))
              ((zero? (mod (vector-ref x y) 5)) (vector-set! x y 'buzz))))
          (iota (vector-length x)))))
    (error 'fizzbuzz "not a vector")))

;; Testing we get the expected result
> (fizzbuzz '#(1 2 3 4 5 6 7 8 9 10 1 12 13 14 15 16 17 18 19 20))
#(1 2 3 4 5 6 7 8 9 10 1 12 13 14 15 16 17 18 19 20)
;; Yep, looks good.

« Last Edit: Fri, 22 May 2015, 11:09:58 by tufty »

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: Fizz Buzz Coding Quiz
« Reply #15 on: Fri, 22 May 2015, 11:07:12 »

I am going to give you an array of numbers: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

You need to write a script that will output this array of numbers either sequentially, or all at once in an array. For each number in the array that is divisible by 3, replace the number with "Fizz" and for each number that is divisible by 5, replace the number with "Buzz"


Code: [Select]
def fizzbuzz(input):
    for n in input:
        if n % 3 == 0:
            yield "Fizz"
        elif n % 5 == 0:
            yield "Buzz"
        else:
            yield n

Offline nmur

  • ಠ_ಠ
  • Posts: 1539
  • Location: Sydney
Re: Fizz Buzz Coding Quiz
« Reply #16 on: Fri, 22 May 2015, 11:14:50 »
Could you post your 3 challenges? I'm about 1 year into my first stint with programming and I'm hungry for bran twisters!

sheer curiosity, is it CS algo questions that you got tested on or more common problem solving?

The challenges I got were specifically involving Matlab and PCL

If you are after more general problem solving challenges that aren't tied to languages, I recommend taking a look at the challenges at Project Euler.

Offline TacticalCoder

  • Posts: 526
Re: Fizz Buzz Coding Quiz
« Reply #17 on: Fri, 22 May 2015, 11:27:33 »
Common guys that FizzBuzz thing is years old...

That said there's one FizzBuzz solution which I really like: it's a satire of Java called "FizzBuzz Enterprise Edition"... It's on GitHub:

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

It's quite complete with classes like:

Code: [Select]
com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.visitors.OutputGenerationContextVisitor
to be sure to adhere to high-quality enterprise Java apps standards  ;)

I'm a Java dev and honestly I find that one very funny ^ ^
HHKB Pro JP (daily driver) -- HHKB Pro 2 -- Industrial IBM Model M 1395240-- NIB Cherry MX 5000 - IBM Model M 1391412 (Swiss QWERTZ) -- IBM Model M 1391403 (German QWERTZ) * 2 -- IBM Model M Ambra -- Black IBM Model M M13 -- IBM Model M 1391401 -- IBM Model M 139? ? ? *2 -- Dell AT102W -- Ergo (split) SmartBoard (white ALPS apparently)

Offline nathanrosspowell

  • * Destiny Supporter
  • Posts: 1559
  • Location: Montreal, QC
    • nathanrosspowell.com
Re: Fizz Buzz Coding Quiz
« Reply #18 on: Fri, 22 May 2015, 11:37:56 »
has anyone ever been asked this in an interview?  i don't understand how someone could be qualified and fail at the same time :/

Yep. Interview at Codemasters for a gameplay programmer, I had three years professional experience at the time as well  :))

The thing is, while I was there they started to ask people to write a string reversal program on the board and a large percentage of post-grads failed.

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #19 on: Fri, 22 May 2015, 13:56:53 »
Common guys that FizzBuzz thing is years old...

That said there's one FizzBuzz solution which I really like: it's a satire of Java called "FizzBuzz Enterprise Edition"... It's on GitHub:

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

It's quite complete with classes like:

Code: [Select]
com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.visitors.OutputGenerationContextVisitor
to be sure to adhere to high-quality enterprise Java apps standards  ;)

I'm a Java dev and honestly I find that one very funny ^ ^

i loled
ALL zombros wanted:  dead or undead or dead-dead.

Offline RedRoboHood

  • Posts: 39
Re: Fizz Buzz Coding Quiz
« Reply #20 on: Sat, 06 June 2015, 08:30:57 »
I've been learning C++ over the past few months, so here's something, I guess. :P

Code: [Select]
#include <iostream>

int main() {
  for (int number{1}; number <= 20; ++number) {
    const bool fizz{number % 3 == 0};
    const bool buzz{number % 5 == 0};
    if (fizz || buzz) {
      if (fizz) {
        std::cout << "Fizz";
      }
      if (buzz) {
        std::cout << "Buzz";
      }
    } else {
      std::cout << number;
    }
    std::cout << std::endl;
  }
}
« Last Edit: Wed, 17 June 2015, 19:14:21 by RedRoboHood »

Offline fenwick

  • Posts: 12
Re: Fizz Buzz Coding Quiz
« Reply #21 on: Sat, 06 June 2015, 14:13:36 »
I wrote one in CSS  ;D

See it working: http://jsfiddle.net/4387o329/3/

Code: [Select]
*{
    position:relative;
}
*:nth-child(3n):after{
    content:"Fizz";
    display:block;
    position:absolute;
    top:0;
    bottom:0;
    background-color:white;
}
*:nth-child(5n):before{
    content:"Buzz";
    background-color:white;
    display:block;
    position:absolute;
    padding-left:3em;
    top:0;
    bottom:0;
}

Offline dimamantra

  • Thread Starter
  • Posts: 137
  • | (• ◡•)| (❍ᴥ❍ʋ)
Re: Fizz Buzz Coding Quiz
« Reply #22 on: Sat, 06 June 2015, 14:55:13 »
I wrote one in CSS  ;D

See it working: http://jsfiddle.net/4387o329/3/

Code: [Select]
*{
    position:relative;
}
*:nth-child(3n):after{
    content:"Fizz";
    display:block;
    position:absolute;
    top:0;
    bottom:0;
    background-color:white;
}
*:nth-child(5n):before{
    content:"Buzz";
    background-color:white;
    display:block;
    position:absolute;
    padding-left:3em;
    top:0;
    bottom:0;
}


Coolest answer on the thread.

Offline Findecanor

  • Posts: 5036
  • Location: Koriko
Re: Fizz Buzz Coding Quiz
« Reply #23 on: Sat, 06 June 2015, 17:35:06 »
This is closest to what I did and it is short, sweet, and to the point.
It is also incorrect. If x is divisible by both 3 and 5 then the output should be "FizzBuzz". That is the catch!

Here is my revised solution in Python. I am using a generator, inspired by metaliqaz code above.
Code: [Select]
>>> def fizzbuzz(seq):
...     for x in seq:
...             s = ""
...             if x % 3 == 0: s += "Fizz"
...             if x % 5 == 0: s += "Buzz"
...             if s=="": s=str(x)
...             yield s
...
>>> print ", ".join(fizzbuzz(range(1,20+1)))
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16, 17, Fizz, 19, Buzz
« Last Edit: Sat, 06 June 2015, 17:52:03 by Findecanor »

Offline tbc

  • Posts: 2365
Re: Fizz Buzz Coding Quiz
« Reply #24 on: Tue, 16 June 2015, 04:37:37 »
I wrote one in CSS  ;D

See it working: http://jsfiddle.net/4387o329/3/

Code: [Select]
*{
    position:relative;
}
*:nth-child(3n):after{
    content:"Fizz";
    display:block;
    position:absolute;
    top:0;
    bottom:0;
    background-color:white;
}
*:nth-child(5n):before{
    content:"Buzz";
    background-color:white;
    display:block;
    position:absolute;
    padding-left:3em;
    top:0;
    bottom:0;
}

MASSIVE props for originality :D
ALL zombros wanted:  dead or undead or dead-dead.

Offline daerid

  • Posts: 4276
  • Location: Denver, CO
    • Rossipedia
Re: Fizz Buzz Coding Quiz
« Reply #25 on: Wed, 17 June 2015, 09:14:22 »
Ahhh good old FizzBuzz. I don't think it will ever die.

Quote
has anyone ever been asked this in an interview?  i don't understand how someone could be qualified and fail at the same time :/

The entire point of FizzBuzz is to establish that the candidate can plain write code. It's a simple enough problem if you've ever written any code before, but it helps to weed out those who can't even write functioning code (there are more than you'd think).

Offline wlhlm

  • Posts: 700
  • Location: Germany
  • ~
Re: Fizz Buzz Coding Quiz
« Reply #26 on: Wed, 17 June 2015, 09:24:30 »
This thread needs a J one-liner.

Offline 1o57

  • Posts: 41
  • Location: East Coast USA
  • %10000100001
Re: Fizz Buzz Coding Quiz
« Reply #27 on: Wed, 17 June 2015, 17:56:56 »
I have asked this question to people in interviews, even recently.  You'd be amazed at how many people get it wrong.

And the original post forgot to mention 15... (just saying...)


Offline dimamantra

  • Thread Starter
  • Posts: 137
  • | (• ◡•)| (❍ᴥ❍ʋ)
Re: Fizz Buzz Coding Quiz
« Reply #28 on: Wed, 17 June 2015, 18:11:35 »
I have asked this question to people in interviews, even recently.  You'd be amazed at how many people get it wrong.

And the original post forgot to mention 15... (just saying...)

Yeah I actually realized that my program is wrong. I've fixed this on my own functions but haven't updated this post.

You are supposed to output 'FizzBuzz' if the number is divisible by both 3 and 5 :p

Offline 1o57

  • Posts: 41
  • Location: East Coast USA
  • %10000100001
Re: Fizz Buzz Coding Quiz
« Reply #29 on: Wed, 17 June 2015, 18:17:04 »
It's designed to see how people deal with the multiple (this case 4) conditions:

1. divisible by 3?
2. divisible by 5?
3. divisible by both 3 and 5?  (Which really means is a multiple of 15...)
4. is not any of the above conditions

The thought process that most go through in an interview (because they're nervous or trying to impress the interviewers) is to try and be 'fancy' with efficiency of the tests (which is why you present the condition about being a multiple of 15 as "both divisible by 3 and divisible by 5"- because intuition is that since you are already doing a check for 3, and a check for 5 you should be able to craft a solution that makes use of those checks only once...which can be done, depending on how you approach the problem....)



I have asked this question to people in interviews, even recently.  You'd be amazed at how many people get it wrong.

And the original post forgot to mention 15... (just saying...)

Yeah I actually realized that my program is wrong. I've fixed this on my own functions but haven't updated this post.

You are supposed to output 'FizzBuzz' if the number is divisible by both 3 and 5 :p

Offline GL1TCH3D

  • Posts: 1117
  • Location: Quebec, Canada
  • Audiophile, tea lover and now keyboard hugger!
Re: Fizz Buzz Coding Quiz
« Reply #30 on: Sat, 20 June 2015, 18:06:04 »
I haven't had time to test it (since I wrote it on my phone in a text editor...) but here's my batch script:

http://pastebin.com/PSRkkS6s

It works on the simple principle that the resultant of a number * 3 or 5 would output a number divisible by those numbers.

Therefore I set each number in the array as an individual variable and overwrote the numbers with Fizz or Buzz if the proceeding for loop regarding multiples results in the same number.

Example:

If you enter 20 the script should calculate 7 for the 3 test and 5 for the 5 test (batch doesn't allow decimal numbers so I add one on top).

Set numbers 1-20 as variables

Multiply numbers 1-7 by 3 and overwrote the existing variables with Fizz based on the result
Do the same with 1-5 by 5.

Output all variables up to the limit of the array.

Hopefully it works, was a fun brain teaser to figure out an effective method.
« Last Edit: Sat, 20 June 2015, 18:33:08 by GL1TCH3D »