Do people who can't fizzbuzz, yet apply for programming jobs, actually exist in real life, Sup Forums? Have you witnessed it? Or is this just a meme?
Also, post your fizzbuzz code in whatever language you like.
Do people who can't fizzbuzz, yet apply for programming jobs, actually exist in real life, Sup Forums? Have you witnessed it? Or is this just a meme?
Also, post your fizzbuzz code in whatever language you like.
Let me guess. You just read a blog post about how x% of job applicants can't program FizzBuzz. You realised that you could program FizzBuzz and became immensely proud of this fact, and decided to show off on Sup Forums.
>Hey /sci/, post your 2+2 calculations in whatever notation you like.
Not immensely proud, the execution of my code is actually kinda ugly, I'm more baffled that people who can't program actually apply for programming jobs. I posted my own code because I didn't find much other than code when looking up "Fizzbuzz" in google images.
2 + 2 calculations can be made to look pretty extensive by the way.
python masterrace
print ("1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz,16,17,Fizz,19,Buzz,Fizz,22,23,Fizz,Buzz,26,Fizz,28,29,FizzBuzz,31,32,Fizz,34,Buzz,Fizz,37,38,Fizz,Buzz,41,Fizz,43,44,FizzBuzz,46,47,Fizz,49,Buzz,Fizz,52,53,Fizz,Buzz,56,Fizz,58,59,FizzBuzz,61,62,Fizz,64,Buzz,Fizz,67,68,Fizz,Buzz,71,Fizz,73,74,FizzBuzz,76,77,Fizz,79,Buzz,Fizz,82,83,Fizz,Buzz,86,Fizz,88,89,FizzBuzz,91,92,Fizz,94,Buzz,Fizz,97,98,Fizz")
if you have applied for programming jobs, then yes, those people clearly exist in real life, since your fizzbuzz is incorrect.
Is it? How?
I failed FizzBuzz during my job interview. I still got the job though.
I still laugh about it.
Nice
did you write this op? cuz the new lines are so wrong
Yeah, I did, I know it does print it messy, I just tried to make it so the "Fizz" didn't newline, so doing an if for 3 and one for 5 would print FizzBuzz.
I thought the FizzBuzz problem said to replace i with FizzBuzz when it's divisible by 3 and 5.
In this program I is still showing.
it's wrong because it stops at 99.
Oh fuck, it's true. My bad, this should get me off my high horse, I'm too used to loop from 0 to n-1 in arrays.
You really only need the newline at the end of every iteration.
just put one new line after the ifs and remove the rest
Oh, that's true as well, thanks for the tip
The FizzBuzz test isn't to show if you can do it. That's easy. The test is to show how efficient you can do it. Putting in unnecessary lines and making it so it only goes up to 99 is two ways that most fail.
Thanks for helping me not be an arrogant asshole, Sup Forums
>i % 3 && i % 5
>not i % 15
Gets me every time.
First the program prints a newline char
Next the program checks if i is a multiple of 3, if true it prints Fizz
Then the program checks if i is a multiple of 5, if true it prints Buzz
Finally, the program checks if i is neither a multiple of 3 or 5, if true it prints i
In this case, a multiple of 3 would pass the first if, not the second, and not the third. A multiple of 5 would fail the first if, pass the second, and fail the third. A multiple of both would pass the first 2 ifs, and fail the third. A multiple of neither would fail the first 2 and pass the third.
why i % 15?
i % 15 is far more readable than printing fizz+buzz
#include
int main()
{
for (int i = 1; i < 101; i++) {
if (i % 15 == 0)
printf("FizzBuzz\n");
else if (i % 5 == 0)
printf("Buzz\n");
else if (i % 3 == 0)
printf("Fizz\n");
else
printf("%d\n",i);
}
return 0;
}
Because 3 * 5 is 15 fucking hell
technically this is correct
> i < 101
so if i asked you to fizz at 4 and buzz at 8 you would i % 32 for fizzbuzz?
exactly the same as
Yeah ive got a buddy who just had a bunch of interviews (one w ibm) and he totally butchered the technical questions he said, they grilled him alive. They didnt ask fizz buzz but he didnt know it when i asked him on the phone
good, now ditch std and you're golden.
How do you get interviewed at IBM and not know fizzbuzz, holy shit...
Then again, I guess IBM only hires poo in the loos now
Well sometimes they are devs who have been programming for years that fail fizzbuzz. I am not exactly sure why these people fail.
I want to see how many FizzBuzzers could handle the (4,8) occasion.
>because 3*5 is 15
15 only works since 3 and 5 are prime, and thus 15 is their gcd. i've asked this before during interviews and few people have gotten it right.
i % 3 && i % 5 is not equivalent to i % 15. Learn basic logic.
I interviewed a girl who couldn't do it, among other questions
She wasn't hired
for(int i=1;i
Because it is a stupid problem. The same reason that mathematicians find it easier speaking of n-dimensional manifolds than figuring out how much they have to pay at a shop.
#include
int main(void) {
for(int i=1; i
but that's wrong
If you rephrase the question as "do people who can't program at all apply for programming jobs" then the answer is yes.
My uncle took an online paid javascript course and was sent some kind of certificate of completion at the end, afterword he tried applying for a couple jobs for java programming positions failing miserably.
Also I work with a guy that after finding out I dabble in game dev as a hobby said he does too and we should team up and make a game, he said he knew how to use photoshop and ue4. After he builds a new development computer he finally admits that this is his first computer ever and that he was hoping I would teach him how to use these tools... and how to use a computer.
Some people really believe they can bullshit their way through life.
How do you build up a resume worthy of an interview if you can't even FizzBuzz? Or do you just interview anyone?
why
>talking about people who can't fizzbuzz
>posted program will not fizzbuzz
2/10 made me reply
The most computationally efficient way of doing a fizzbuzz.
if {...}else if{...}else{...} structure does exist for a reason. Yes, in the fizzbuzz it does not change much
but producing quality code should be in your top 3 priorities at all time.
fb = fn
(0, 0, _) -> "fizzbuzz"
(0, _, _) -> "fizz"
(_, 0, _) -> "buzz"
(_, _, n) -> n
end
fizzbuzz = fn n -> fb.(rem(n, 3), rem(n, 5), n) end
Enum.map(1..100, fizzbuzz)
#include
int main(void)
{
int i, fizz, buzz;
for(i=0; i
This needs to go on one of those CS graduate pics.
Fizzbuzz is a fucking meme designed to impress non-programmers. You don't ask for it in an interview because someone who can't do it simply wouldn't graduate in the first place.
Yes it is.
That case you could just write FizzBuzz at 8.
Line 12 in is where I test the case "i is not a multiple of either 3 or 5". I don't test 15 for "FizzBuzz" since that's already done by appending the 3 and the 5 cases if i happens to be a multiple of both.
>he cant multiply two numbers recursively
>ditch std
He shouldn't.
If not fizz; print Fizz
...
I prefer using the std:: over using a whole namespace or polluting my code with a local using std.
>recursion
enjoy your mile long stack call, buddy
Why? It work just fine?
Typical CS faggot, thinks he is great for coming up with some unnecessarily complicated way of doing something using superfluous functions like modulo arithmetic.
I think it has to do with possibly printing stuff twice, but I'm not sure
clever on the i%3 && i%5 but it's hard to read if you don't know C
No it isn't.
>>> def f1(i): return i % 3 and i % 5
...
>>> def f2(i): return i % 15
...
>>> f1(3) == f2(3)
False
For you special, make your fizzbuzz go up to even 1000, and you're going to need to do 10 times the work of someone who wrote efficient code
whats wrong babby
i%3 isn't the same as i%3==0. i%3 is an integer. he's doing (integer && integer) so it's checking whether either of the integers are 0, which would mean they divide evenly by either 3 or 5
In pic there is no loop, so main will print "1\n" and exit (assuming the rest of main follows the same structure until k == 99 and returns after that). Remove the all of the "else"s and you've got yourself a fizzbuzz.
#include
int main()
{
int i = 0, j;
const char *buzzer[] = {NULL, "fizz", "buzz", "fizzbuzz"};
while(i++ < 100)
if(j = !(i%3)*1 + !(i%5)*2)
printf("%s\n", buzzer[j]);
else
printf("%i\n", i);
return 0;
}
Maybe they never heard about Fizzbuzz? I didn't have that sort of a division game taught to us when I was a kid for example.
Now that I know it I don't think that there would be programmers who aren't capable of coding it desu.
it works fine except \n should be put at the end. test it.
Thanks
i don't mean using std, i mean don't use std in the first place because it's crap.
Dont initialize the variables in a for loop either.
Yeah, someone pointed it out, here's a corrected version
why would you not initialize a variable in a for loop, then use it as a sentinel variable? It makes complete sense to do that
for (int i = 0; i < 100; i++)
{
//code increments i until exit
}
I went to a top CS university and I doubt that more than 40% of my peers could write a fizzbuzz from scratch.
I went to a top CS university and doubt more than 40% of my peers can do fizzbuzz.
>implement an actual, non-"le funny smart xD" FizzBuzz
>print it into a source file's print statement/function call as if it were le funny smart
I went to a top CS university and doubt more than 40% of students can fizzbuzz.
It's not about multiplication, it's about their gcd (greatest common divisor). Since both 3 and 5 are prime their gcd is 3*5
u ok dude?
He think I type it by hand. This is why vim and copy & paste were invented.
Kill yourself and your unnecessary CS obfuscation. Intellectual masturbation that is useless in the real world. Fucking autist.
I was asked to write, in paper, what the python code "range(3)" meant... I had used range() many times, but didn't remember what it did, so I first thought it would be [1, 2, 3]. then I remembered it also included 0... this confused me even more, and ended writing [0, 1, 2, 3].
of course, I could have replied by analyzing it logically: range(n) is usually used to get n numbers, starting from 0... ie, up to n-1
the tl;dr is: distractions and nervousness can fuck you, which is why fizzbuzz is not only about code.
some people might not known about/use/give importance to the modulus operator (%). Try doing it without it.
what is a fizzbuzz
lots of things work like that. like in most languages if they have a random(x) function it returns something from 0 to x-1
Oh boy, here comes the self-taught programmer who tried to reinvent the wheel until a CS grad came in and said "oh, this is a use case for !" in O(1) time
If we are talking about integers (and we are) then (i % 3 && i % 5) is not equivalent to (i % 15).
Do I really need to prove this point?
The modulo operator defines a ring, so let's look at the residue class of "mod 15":
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
Now for each of that numbers let's look at the residue classes of "mod 3" and "mod 5", written in parenthesis:
0 (0,0)
1 (1,1)
2 (2,2)
3 (0,3)
4 (1,4)
5 (2,0)
6 (0,1)
7 (1,2)
8 (2,3)
9 (0,4)
10 (1,0)
11 (2,1)
12 (0,2)
13 (1,3)
14 (2,4)
As you see, there is no value x between 0 and "0 + n*15" with the property of being 0 for "x mod 3" and "x mod 5".
I'm pretty sure you're lying.
Webdevs really are trash, fuck.
OBFUSCATION
When is the last time that has happened in real day to day code?
I train CS grads all the time and the first thing we have to teach them is to stop trying to overcomplicate everything. Just fucking solve the problem and move on.
I heard of a dude who got a job programming, like so:
>So, applicant, do you know how to program?
>Eh... y-yes...
>What lanugage?
> Uh, C++?
>You're hired!
Applicant then went to a technical bookstore and bought a "learning C++" book
spotted the pythonista
Sounds like the story of how Bill Gates supposedly sold DOS to, what, IBM, without having a single line of code for it actually written
Ah well, now I see your point:
OP did a check so each number that isn't a fizz or a buzz remains..
I stand corrected.
But nevertheless this is a sub-par way of doing it, since you double check. A simple boolean which gets TRUE for i%3 or i%5 would halve the nr. or modulo comparisons (and mod is expensive)..
Or some other OS that he was supposed to make, of course he didn't sell DOS lel
Distilled autism
Oh I see
...
Goddamn it, you caught the Brazilian in the thread, my fucking sides
A[I]←1+I←(0⍷A)/⍳⍴A←('FIZZBUZZ' 'FIZZ’ 'BUZZ' 0)[2⊥¨×(⊂3 5)|¨1+⍳100]
get on my level scrubs
++++++++++[>++++++++++>++++++++++>->>>>>>>>>>>>>>>>-->+++++++[->++
++++++++[->+>+>+>+>++++++++[-]++++
+[-]>>-->++++++[->+++++++++++[->+>+>+>+++++++>++++++++[-]++++++[-]>>-->
---+[-+>[-]++[-->++]-->+++[---++[-->-[+
+++[----]++[-->++]--++[--+[->[-]+++++[---->++++]-->[
->+>[.>]++[-->++]]-->+++]---+[->-[+>>>+[->>++++++++++-[>+>>]>[+[-]>+>>]+>>]>[+[-]>
+>>]
Was about to say, someone should make fizzbuzz in brainfuck, beat me to it.