"99% of Sup Forums cannot fizzbuzz. You're not one of them, right user?"

>"99% of Sup Forums cannot fizzbuzz. You're not one of them, right user?"

Other urls found in this thread:

css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/
twitter.com/NSFWRedditGif

BRAAAAAAAAAAAAAAAAAAAP

if(true){
return;
}

if num == 10 { urmom

I can fizzbuzz:
interface FizzBuzzable {
public int value();
public String doFizzBuzz();
}
final class FizzBuzzableNumber implements FizzBuzzable {
private final int num;
public FizzBuzzableNumber(int n) { this.num = n; }
public final int value() { return this.num; }
public final String doFizzBuzz() { return new Integer(this.num).toString(); }
}
abstract class DivisibleNumber implements FizzBuzzable {
protected final FizzBuzzable original;
public DivisibleNumber(FizzBuzzable origin) { this.original = origin; }
public final int value() { return this.original.value(); }
public final String doFizzBuzz() {
String fizzBuzzed;
if (this.isDivisible())
fizzBuzzed = this.fizzBuzzing();
else
fizzBuzzed = this.original.doFizzBuzz();
return fizzBuzzed;
}
protected abstract boolean isDivisible();
protected abstract String fizzBuzzing();
}
final class NumberDivisibleByThree extends DivisibleNumber {
public NumberDivisibleByThree(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz"; }
protected final boolean isDivisible() { return ((this.value() % 3) == 0); }
}
final class NumberDivisibleByFive extends DivisibleNumber {
public NumberDivisibleByFive(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 5) == 0); }
}
final class NumberDivisibleByThreeAndFive extends DivisibleNumber {
public NumberDivisibleByThreeAndFive (FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 15) == 0); }
}

public class Main {
public static void main(String[] args) {
for (int i = 1; i

Throw new OpIsAFagException(500);

css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/

post the other half of that gif where he shows his girl cock

is it strange that i've never did fizzbuzz? actually, where i study people won't even know about it, probably.

...

>Enterprise fizzbuzz

i fizzbuzz in assembler
eat that bitches

for num in xrange(1,101):
if num % 5 == 0 and num % 3 == 0:
print "FizzBuzz"
elif num % 3 == 0:
print "Fizz"
elif num % 5 == 0:
print "Buzz"
else:
print num

someone links the github repo

>Enterprise grade

This is the kind of shit I deal with every day at work, but in C#/.Net

#include

public static void main {}
{
cout
}

Why do Fizzbuzz when you can take it a step higher and do Flozzblazz?

You're doing Java/C# just right user, gg

>he doesn't fozzlebozz

I'm at the rugby you fuckstick. Too busy for that shit.

_.range(1, 6gorilions)
.forEach(num => {
if (num % 15 == 0) { return console.log('FizzBuzz'); }
if (num % 5 == 0) { return console.log('Buzz'); }
if (num % 3 == 0) { return console.log('Fizz'); }
else return console.log(num);
}

klassik

console.log has no return value, you tool
and if you have return statements inside a conditional, using 'else' is pointless
>:(

Nigga just do:
var out='';
for (var num=1; num

Stop shitposting with clips from porn of solo shemales. Do something productive with your fucking time.

org 0x100
use16
xor cx, cx
xor ax, ax
aa: push ax
mov bp, sp
push 0x0024
push 0x0a0d
test cl, cl
jnz @f
mov cl, 0x05
push 0x7a7a
push 0x7542
@@: test ch, ch
jnz @f
mov ch, 0x03
push 0x7a7a
push 0x6946
@@: sub cx, 0x0101
pop dx
push dx
cmp dl, 0x0d
jne @f
xchg al, ah
or ax, 0x3030
push ax
@@: mov ah, 0x09
mov dx, sp
int 0x21
mov sp, bp
pop ax
inc ax
AAA;!!!
cmp ah, 0x0a
jne aa
ret
70 bytes.

FizzBuzz without the modulo operator. Even if you have never used or even seen the modulo operator in your life, you still have no excuse to be unable to solve this. The only knowledge you need to be able to solve this is basic concepts of iteration, if statements, and variable assignment.

#include

int main(void)
{
// rem3 and rem5 store the remainder when
// i is divisible by 3 and 5 respectively
int rem3 = 1, rem5 = 1;
for (int i = 1; i

Array.from(Array(100)).map((_,idx) => idx + 1).map(num => {
if (num % 3 && num % 5) return num
var result = "";
if (!(num % 3)) result += "Fizz"
if(!(num % 5)) result += "buzz"
return result;
});

for (i=1;i

>timecode string to seconds
Microwave time to seconds?

(map (lambda (x)
(cond ((= (modulo x 3) 0) 'fizz)
((= (modulo x 5) 0) 'buzz)
((= (modulo x 15) 0) 'fizzbuzz)
(else x)))
(iota 100 1))

>if num % 5 == 0 and num % 3 == 0:
instead of
>if num % 15 == 0:

Sorry, you didn't get the job.

I never thought about how to solve it assuming I didn't know what modulo was, but this was nice and clean. Good job.

Wow this is some enterprise certified fizzbuzzing

test plox

def FizzBuzz(number)
i = 0
1.upto(number) do
if i % 5 == 0 and i % 3 == 0 then
puts("FizzBuzz")
elsif i % 5 == 0 then
puts("Buzz")
elsif i % 3 == 0 then
puts("Fizz")
else
puts(i)
end
i += 1
end
end

FizzBuzz(100)


How did I do fa/g/s?

I haven't tried so I probably cant yet. But I'm sure it can't be too hard

Refer to:

Can someone explain how to do the time in string one?

Would you cast it to int to start

>implying their dicks won't explode when they see my github anyway.

function timeToSeconds(time){
time = time.split(":").map(item => Number(item));
var seconds = time.pop();
if (time.length){
return seconds += time.reduce((a,b) => {
b += a * 60;
return b;
}) * 60;
} else {
return seconds;
}
}

You believe that after they see that you don't understand basic mathematical concepts like LCM/GCF that they're going to hire you?

LUL

>mad NEET

This is javascript:
I don't know much about anything other than Js or Python, but if you're able to split , then map then that would be the ideal way of casting them to integers.

>'15' branch will never be taken
As expected, Lisp-fags can't program anything more complex than factorial.

>calling someone a NEET to defend against your ignorance

Good job, kiddo.

lol Just realized I could've done

return time.split(":").map(item => Number(item)).reduce((a,b) => {
b += a * 60;
return b;
});

>always thought fizbuzzing was going to be some horrific buzzword laden big-o google recruitment shit
>its literally just lambda and modulo

wew... am I one of the good ones then?

No, it's extremely simple. The goal is to be able to do it with speed and beautifully - without remembering.

watch this fucc
d=(a,b)=>{
while (a)if((a=(le=>((f=>f(f))(f=>(le((...x)=>f(f)(...x))))))
(ad=>(a,b)=>(b)?ad(a^b,(a&b)

You are why professional coding is a shithole full of limpdick pegboard nerds.

>literally just lambda

Nobody in this thread did it as a lambda. You don't know what that is, do you?

Wouldn't it be more proper not to bury your magic numbers? In which case you can't use magic number 1 * magic number 2 unless both are prime.
#include
#define FIZZ 3
#define BUZZ 5
#define LIMIT 100
int main()
{
for(int i=0; i

SNIIIIIIIIIFFF

Chea Rangi

Damn nigga you have me beat. What the fuck is the le thing I've been seeing?

>#define FIZZ 3

HAHAHAH HOLY SHIT YOU FUCKING WHAT

Is this a meme? Or do you unironically think that is an appropriate method of defining that variable?

it's Y combinator in javascript

you would get laughed out of an interview and spit on in a classroom for defining variables like that, please don't ever do that again

It's what K&R suggest in their book when dealing with magic numbers

int fizz = 3;

nigga what

>not denying your NEEThood
>NEET confirmed


>gg kiddo

That's awful. I unironically cringed.

Whaat

module FizzBuzz where

fizzBuzz x = mapM_ print $map checkFizzBuzz [1..x]

checkFizzBuzz val
| val `mod` 15 == 0 = "FizzBuzz"
| val `mod` 3 == 0 = "Fizz"
| val `mod` 5 == 0 = "Buzz"
| otherwise = show val

Notfizzbuzz = ' ';
Fizz = "fizz";
Buzz = "buzz";
Fizzbuzz = "fizzbuzz";
For i < 100; I++;
If 1 print notfizzbuzz
If 2 print notfizzbuzz
If 3 print buzz
If 15 print fizzbuzz

Fuck user it's pretty easy get over yourself.

Why, is K&R really that out of date and no longer useful?

You should certainly not be defining variables like that for any purpose. There's never a good reason in any program to do it that way. I mean, of course that's just an opinion and there's never a right way to do programming, but it's industry standard to NOT define vars in that manner.

[spoiler]Defines are not variables. What he does is right.[/spoiler]

ok so from reading the replies it seems it's a guy but jokes on you i wasn't even aroused. i was about to comment something like "imagine being an average girl who doesn't even lift or anything and all you have to do is pull down your pants to get (You)s"

>you need math to code
You would get shit for writing a non-expandable pile of crap full of magic numbers but not for math-related issues.

Since you're replying to him I'd think you'd do
```
if (i % FIZZ * BUZZ === 0)
```

>python
for num in xrange(1,101):
msg = ''
if num % 3 == 0:
msg += 'Fizz'
if num % 5 == 0:
msg += 'Buzz'
print msg or num

>not being aroused by the obvious trap
>still angry enough to whine about OPs (You)'s

I know that at least the Solarized developers use it.
The .Xresources file they ship with has a bunch of #define for the various colors. Which is a shame because GNOME for example ends up doing xrdb --nocpp ~/.Xresources

tiny mode i like it

You're right, they're not variables. Variables are what he should've been using, though, as there is LITERALLY no reason or excuse for using defines. In fact, variables aren't even necessary as the cleanest way to go about this basic problem is close to how
did it.

>you can't use magic number 1 * magic number 2 unless both are prime.
They only have coprime.

Only works if FIZZ and BUZZ do not share a common prime factor
Let FIZZ = 4, BUZZ = 6
Your code will miss 12

>the cleanest way to go about this basic problem is
Magic numbers are anything but "clean"

modulus and three if statements right?

I should also add that I decided to look at some random code from the Linux kernel, they use #define in the first code I see.
Maybe it is something to do with C.

javafag here:

import static java.lang.System.out;
public class denn {

public static void main( String [] args){

for (int i= 0; iinb4 that unnecessary import ;)

what the fuck is this language? looks like an C++ and C# fucked but then C# aborted. however, C++ took the aborted fetus and presented as a functioning language

just forget to adding "

>AAA;!!!
AAAAAAA!!!!!!

...

Why did you copy me?
n = 1
while n < 101:
out = ''
if not n % 3:
out = 'Fizz'
if not n % 5:
out += 'Buzz'
if out == '':
print(n)
else:
print(out)
n += 1
Mine is better because for loops are inferior to while loops.

There's no magic numbers?

His is clearly better.

Five is a magic number. Three is a magic number.
Not encapsulating your conditions is generally a bad idea.
Given ruby has a proper "for" loop over ranges, using it instead of manually incrementing a variable would be a more readable solution.

If someone's told to make this FizzBuzz react to different numbers - they'll have to edit the algorithm directly. If they'll need to add a third number - they'll have to alter it altogether.

Code should be written in a way someone who has no fucking idea what's it all about can properly read it.

>python 2

So you're going to write code that handles any number of numbers and messages?
Keep it simple stupid.

>three division ops
>not two and a comparison

I'm sorry, we're looking for someone else.

>implying the compiler doesn't do this for you

['Fizz'*(not i%3) + 'Buzz'*(not i%5) or i for i in range(1, 100)]

the compiler does it for you. you're a fucking jackass for writing unreadable code for no reason

>the compiler does it for you
well not the i % 15 part but i mean not explicitly storing the m3 and m5 variables

that girl has almost no ass, it's all angle.

it's a trap, and yeah it's a totally uninteresting ass, it's a weak bait, yet it's the best the trapfag trolls can come up with