[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
My dad's a senior .Net developer and he just told me that
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 136
Thread images: 10
File: 666.jpg (237 KB, 700x777) Image search: [Google]
666.jpg
237 KB, 700x777
My dad's a senior .Net developer and he just told me that some of his interviewees fail the fizzbuzz test???

there's literally nothing to it, I just wrote this up in 5 minutes, is it wrong? Am I retarded?

public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
if (i % 3 == 0 && i % 5 == 0) {
System.out.println(i + ". FizzBuzz");
}
else if (i % 3 == 0) {
System.out.println(i + ". Fizz");
}
else if (i % 5 == 0) {
System.out.println(i + ". Buzz");
}
}
}
>>
do your homework yourself pajeet
>>
>>54698021
lol i'm just really baffled that some people fail this. I don't get it, what's so difficult about it that people would actually fail it. The people who just got their bachelors or some shit in CS fail this?
>>
>>54698007
Why don't you go ask your dad.
>>
>>54698053
he told me he doesn't understand why either
>>
your implementation could be simpler btw you're not as smart as you think you are
>>
>>54698059
>>54698007
That's not a correct solution, retard. Go tell your dad he failed as a parent
>>
>>54698070
this is not about me being smart because I'm not. I'm just trying to understand why this is difficult for some people.

>>54698074
wait really? shit lol
>>
What the hell is this fizzbuzz thing, and why does /g/ seem to be talking about it a lot in the past couple weeks?
>>
>>54698102
It's summer
>>
>>54698102
It's yogic bugs Vader joining cars bumpy chance Krugerrand bucks joining hard bunch ketch bumps.
>>
>>54698112
Aah. I also read the actual code OP posted and got the gist. Does there have to be a '. ' before the fizz/buzz?

Also, should the non fizz/buzz numbers be displayed? Because OP doesn't seem to have that...

>>54698130
Yes, 100%... >_>
<_<
>>
>>54698145
You have to be 18 to use this website
>>
>>54698151
Which I am.
>>
>>54698145
i just did that for readability

>>54698074
>>54698070
fine, here go, here's another implementation

for (int i = 1; i <= 100; i++) {
System.out.println((i % 3 == 0 & i % 5 == 0) ? "FizzBuzz" : (i % 3 == 0) ? "Fizz" : (i % 5 == 0) ? "Buzz" : i + "");
}
>>
>>54698156
Well, then you're a fucking adult. Solve your own problems. Use Google.
>>
>>54698157
Still broken, and unreadable
>>
>>54698159
But then I wouldn't be having such a lovely discussion with people like you.
>>
>>54698167
you got me on the unreadability, but how the fuck is it broken?
>>
>>54698167
Isn't the question:
print numbers from 1 to 100. if the number is a multiple of 3, print Fizz, if the multiple is 5 print Buzz, and if it is of both, print FizzBuzz?
>>
>>54698180
>how the fuck is it broken?

Congrats, you just failed the interview. You're supposed to explain to ME why it works
>>
>>54698194
No, it's not.
>>
>>54698209
Well then what is it? I'm googling the question and it's exactly that
>>
>>54698253
For each number, 1 to 100, print Fizz if divisible by 3, or Buzz if divisible by 5, or FizzBuzz if divisible by 3 and 5, else print the number.
>>
>>54698288
that's exactly what I said
>>
>>54698299
So you can't read or write?

You said

>print numbers from 1 to 100

Oh, by the way, you failed the janitor interview by this point too
>>
>>54698320
I see what you're saying. So is this really how people fail the interview?
>>
>>54698343
Yes. It's not so much about the question, but how you answer it. How do you think? How do you problem solve? Do I want to work with you 8 hours a day?
>>
>>54698361
Wow, never thought about it like that. I'm entering my sophomore year at uni, so I don't have any work experience. Thanks for the insight
>>
File: 1419318553101.jpg (13 KB, 211x193) Image search: [Google]
1419318553101.jpg
13 KB, 211x193
>>54698381
>I'm entering my sophomore year at uni, so I don't have any work experience.
>>
>>54698381
>I'm entering my sophomore year at uni, so I don't have any work experience

That's not good. I had two internships by that point. You better ask your dad whose dick you need to suck at his company to get a job.
>>
>>54698398
Were they two unpaid internships?
>>
>>54698695
No. First one was $17/hr, second one was $38/hr
>>
>>54698713
>mfw making $12 an hour for my internship

fuuuuuuuuuck
>>
I'm not employed in a technology field (well, it uses technology, but I'm not writing or maintaining the infrastructure), and I learned this in a few minutes on CodeAcademy a long time ago. Are you telling me there's people who are supposed to be "programmers" getting INTERVIEWS and they can't come up with this? That's pretty hilarious that they'd even make it to an interview.
>>
>>54698781
It's better than nothing
>>
>>54698781

What the hell? What are you studying? If it's CS that's obscenely low (assuming US or Canada). you should probably be making closer to $20/hour. More if it's a good company and/or in a high-expenses area like the bay area.

Do they cover your costs of living with a housing stipend at least?
>>
>>54698695

Do unpaid internships even exist in CS/engineering? Every one I see is $15-45/hour. I keep seeing people talk about internships as if they're unpaid in general. Is this for biology/etc, or are there actually unpaid programming ones? Why would anyone do them?
>>
>>54698007
use haskell, it's better
 
fizzbuzz n | n % 15 = "FizzBuzz"
| n % 3 = "Fizz"
| n % 5 =" Buzz"
| otherwise = show n
where % = mod

main = mapM_ (putStrLn . fizzbuzz) [1..100]
>>
File: 1454149807399.jpg (18 KB, 212x292) Image search: [Google]
1454149807399.jpg
18 KB, 212x292
>>54698007
> == 0
How about you use a real man's language
>>
#include <stdio.h>

int main(int i)
{
char *s[] = {"%d\n", "Fizz\n", "Buzz\n", "FizzBuzz\n"};
for (i=0; i++ < 100;)
printf(s[!(i % 3) + (!(i % 5) * 2)], i);
return 0;
}
>>
File: pretty_much.png (585 KB, 855x643) Image search: [Google]
pretty_much.png
585 KB, 855x643
>>54700090
>his language has shitty typing
>his language thinks 0 is a False and anything else is True
>>
>>54700110
>sir, this implementation is too arcane
>im afraid we need someone who works with others and keeps their code readable and efficient
>we do have this janitor position open though, you want it?
>>
File: shrug.jpg (6 KB, 259x194) Image search: [Google]
shrug.jpg
6 KB, 259x194
>>54698007
It's my first day programming and I've noticed that python is clean and minimalistic compared to other languages.
<code>
count = 0
while (count < 101):
if (count % 5) == 0 and (count % 3) == 0:
print "FizzBuzz"
count = count +1
elif (count % 3) == 0:
print "Fizz"
count = count + 1
elif (count % 5) == 0:
print "Buzz"
count = count +1
else:
print count
count = count + 1
</code>
quality copy pasta that I can understand.
>>
>>54700193
see >>54700055 for concise
>>
>>54698007
>My dad

Stopped reading. Come back when you actually know what you're talking about, and not your dad's second hand experience.
>>
File: kek.jpg (34 KB, 500x357) Image search: [Google]
kek.jpg
34 KB, 500x357
>>54700199
>main = mapM_ (putStrLn . fizzbuzz) [1..100]
is that an actually joke? I feel like using Haskell is the same as being able to write in hieroglyphics... sure it has historical value but it's not worth using anymore.
>>
LOOK
RETARDS
IF YOU TYPE OUT
THE STRING

"FIZZBUZZ"

YOU HAVE FAILED.
THE END.
>>
>>54700308
but I need to put a newline, dumfuck,
and also, testing every if clause a shit

>>54700306
its pretty straightforward if u know haskell

its like me criticizing the syntax of a language I don't know

kys, scrub
>>
File: 1342695915642.png (41 KB, 400x400) Image search: [Google]
1342695915642.png
41 KB, 400x400
>>54700110
mfw it clicked.
>>
>>54700306
thats like saying C is hieroglyphics when I don't understand what the ? dods
kill yourself you nigger faggot
can't believe I share a board with retard like these
>>
>>54700193
you should use <= 100 its much clearer what that condition is meant to achieve.

Also you can use count += 1 to have count be assigned its old value + 1.
>>
>>54700384
IF YOU HAVE TO
WRITE
"FIZZ"
THEN
"BUZZ"
THEN
"FIZZBUZZ"
BY HAND

YOU HAVE FAILED.
99% OF G FAILS AT FIZZBUZZ
>>
>>54700437
anyone can do that
but newlines are needed
also, stop writing in caps lock u autist
>>
>>54700193
more like
for x in xrange(1, 101):

fizz = not x % 3
buzz = not x % 5

if fizz and buzz :
print "FizzBuzz"
elif fizz:
print "Fizz"
elif buzz:
print "Buzz"
else:
print x
>>
>>54700461
APPARENTLY NOT
>>
>>54700463
>how to print out 34, by anon

>print 3
>pause
>then print 4

it's like no one on this god damned board can program
>>
>>54700493
?
>>
>>54700477
why r u afraid of fizzbuzz?
its more readable

also, nowt ur implementation, genius
>>
File: 1463973258064.jpg (143 KB, 738x767) Image search: [Google]
1463973258064.jpg
143 KB, 738x767
>>54700493
>>
>>54700502
refer to >>54700437

here's a challenge
make a fizzbuzz script
where you don't have to write "fizzbuzz" by hand.

there. Now you can program.
>>
>>54698007
>5 minutes
>not 1 minute
Yep. Retarded is the word.
>>
>>54700509
>not an argument
>not related to topic
>butthurt

deal with it fucko, you can't program your way out of a paper bag

Although to be honest I only just realized this now.
>>
>>54700522
autismo is alive
>>
>>54700510
>haha lol, these fucking idiots can't into my ideal fizzbuzz
>see my implementation, it's much better, took 4 hours to write though
>it's not as readable too, but who cares, I win with my arcane implementation
>hahaha, those loosars
>>
File: 1464045113651.jpg (20 KB, 420x265) Image search: [Google]
1464045113651.jpg
20 KB, 420x265
>>54700510
I never figured out the code tags, have pity on me.
>>
>>54700533
>>54700540

still no argument

we're talking about programming here, you obviously can't program, so I understand your inferiority complexes

>>54700540
if you waste time handcoding a case which your script can manage naturally, you failed

you're on the level of people who don't understand loops and write 1 through 100 cases by hand
>>
>>54700540
see
>>54700556
its easy as fuck.
>>
        // v.1
final String[] FB = {"Fizz", "Buzz"};
for(int i = 0; i <= 100; i++)
System.out.println(i % 3 == 0 ? i % 5 == 0 ? FB[0] + FB[1]: FB[0] : i % 5 == 0 ? FB[1] : i);




// v.2
for(int i = 0; i < 100; System.out.println(i++ % 3 == 0 ? i % 5 == 0 ? "Fizz" + "Buzz": "Fizz" : i % 5 == 0 ? "Buzz" : i));




            // v.3
for(int i = 0; i < 100; i++)
{
if(i % 3 == 0)
{
if(i % 5 == 0)
System.out.println("FizzBuzz");
else
System.out.println("Fizz");
}
else
{
if (i % 5 == 0)
System.out.println("Buzz");
else
System.out.println(String.valueOf(i));
}
}
>>
>>54699956
A lot of startups in the UK exploit CS students by offering free internships. They tell you that you get a better learning experience and more independence yo rope you in.
>>
>>54700556

there you go. You can program. You are not wasting time typing out something your program is printing out anyway.
>>
            // v.4
for(int i = 0; i < 100; i++)
{
String outStr = "";
outStr += (i % 3 == 0) ? "Fizz": "";
outStr += (i % 5 == 0) ? "Buzz": "";
outStr = outStr.isEmpty() ? String.valueOf(i): outStr;
System.out.println(outStr);
}


            // v.5
for(int i = 0; i < 100; i++)
{
boolean isNotFizzBuzz = true;
if (i % 3 == 0)
{
System.out.print("Fizz");
isNotFizzBuzz = false;
}
if (i % 5 == 0)
{
System.out.print("Buzz");
isNotFizzBuzz = false;
}
if(isNotFizzBuzz) System.out.print(i);
System.out.println();
}
>>
>>54700583
what the fuck are you even doing?
>>
>>54700593
Fizzbuzzing
>>
>>54700571
>no i % 15
>extra line
>doesn't even output what is desired
its always, number and fizz or buzz or none
ur a faggot, u preach about muh inaneness and fail to realize you write extra inane crap by trying to achieve ur ideal shitty version that doesn't even output the desired
>>
>>54700610
>no i % 15

Are you legitimately retarded?
>>
>>54700593
Can you read the code?

It's pretty clear what I'm doing: output "Fizz" if divisible by 3, "Buzz" if divisible by 5, "FizzBuzz" if both, the number if neither.
>>
>>54700610
oh so you want to print all the numbers? remove first and last condition, keep the inner statements, bam, done.
>>
>>54700559
>>54700579
that's bullshit senpai

it makes sense if you're thinking in terms of a program that literally does nothing but fizzbuzz, and that's all it will ever do, but what if, for instance, you want to print something ELSE if the number is divisible by 3 and 5?

then you have to rewrite the program in exactly the same way as if you wrote your code with the string "fizzbuzz" to begin with. all because you had to be a super cool efficient programmer with your perfect fizzbuzz implementation.
>>
>>54700610
>its always, number and fizz or buzz or none

Or you know, it might be fizzbuzz.
>>
>>54700625
seems like you are, considering its better than if i % 3 && i % 5
again, u preach about inaneness but write this shit
you also use python
so no wonder that u think you know how to program
>>
>>54700556
You retard that wasn't the question
Nobody cares about your programming skills if you can't do what you're asked to do
>>
>>54700645
obviously u don't know what the original problem is
the problem they ask in interview questions, you know

I know what fizzbuzz is, cuck
>>
>>54700639
>but what if, for instance, you want to print something ELSE if the number is divisible by 3 and 5?

except that's not the case. The case is fizz if by 3, buzz if by 5.

There's no 15 mentioned in the task.

a is fizz
b is buzz
you don't need to figure out what a+b is

>>54700645
fizzbuzz doesn't exist you idiot. It's a combination of fizz and buzz

>>54700646
that's not my code Tayquan. You are legitimately retarded it seems.

>>54700639
>you had to be a super cool efficient programmer with your perfect fizzbuzz implementation

Isn't that exactly the point? Isn't that the test?

>>54700655
>that wasn't the question

except it was

fizz if by 3
buzz if by 5
fizzbuzz if by both

All accomplished. That anon just got the job and you're left wondering why your manual write in case isn't as good as their dynamic one.
>>
>>54700631
you're still a hypocrite because it's inane
its also inefficient
>>
beat thjs
for i in range(1,101):
print("FizzBuzz"[i*i%3*4:8--i**4%5] or i)
>>
>>54700110
i = 15
printf(s[!0 + !(0 * 2)], i) = printf("FizzBuzz\n", i);

the fuck?
>>
>>54700679
>you don't need to figure out what a+b is

you don't need to be a genious to figure out*
>>
>>54700679
and n if none, cuck
>>
static void Main(string[] args)
{

string[] fizzText = new string[] { "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", "Buzz" };

foreach (string fizz in fizzText) { Console.WriteLine(fizz); };
}
>>
>>54700681
>because it's inane

just because you can't comprehend something doesn't mean it's unintelligible.

>it's also inefficient

Go ahead fuckwad. Scale that anons code then scale yours. See which one executes quicker.

>>54700699

Your bait is not much worse than all the "programmers" who write in "i%15==0?'fizzbuzz'" shit. It's all the same, wasting time.
>>
>>54700679
but you still support his code, which is inane, and that's what u preach about
kill yourself u insufferable faggot
>>
>>54700646
#include<stdio.h>

int main()
{
int i;
for(i = 1; i <= 100; i++){
printf("%d:",i);
if (!(i % 3))
printf("Fizz");
if (!(i % 5))
printf("Buzz");
printf("\n");
}

return 0;
}


am I cool yet?
>>
>>54700735
>his code, which is inane

his code and some of these >>54700583
>>54700573 are the only working solutions here
>>
>>54700679
so you can't even follow your own made up instructions?
no one asked you to print a tab
it's FizzBuzz not fizzbuzz
it doesn't output the number if it's neither Fizz nor Buzz

and that code is an inefficient piece of shit
star by indenting the 2nd and 3rd if () and get rid of the last if () but keep the empty print
>>
>>54700743
>sorry anon, the problem said to output n if by none
>u can't get his job, I'm sorry
>>
>>54700753
>it doesn't output the number if it's neither Fizz nor Buzz

who gives a shit, that's an overlook that can be fixed.

thinking that literally typing in a case instead of using the code to solve is somehow efficient can not be fixed.
>>
>>54700757
I don't know that language but isn't that what the first printf does?
>>
>>54700775
indeedily it is, its C, worth picking up imo.
>>
>>54700747
>>54700055 works too

>>54700720
his code is ineficient
it tests too much
also, readability is much preferred than the 0.00002 second increase u cuck
clearly something u don't know because uvee never Been hired
>>
>>54700774
>hey anon your code doesn't do what it's supposed to do
>who gives a fuck, that's an overlook that can be fixed
>uh sure you can leave now
did you forget that this thread is about passing a FizzBuzz interview?
>>
>call yourself a programmer
>fail at the most basic test because you're incapable of automating it

>>54700801
>I do not understand scaling - the post

>>54700810
and only one of you is intelligent enough to pass it
>>
>>54700801
>it tests too much
> readability is much preferred than the 0.00002 second increase u cuck

pick one. If you can't read what I wrote then maybe you should do remedial 101
>>
>>54698007
>My dad...
D R O P P E D

R

O

P

P

E

D
>>
OP Please fuck off
Reddit is the place for you
>>
>>54700801
I bet you also think Java is a good language to use for neural networks
it's those ""0.00002"" seconds that when added up and then multiplied by amount of runs that make shit so slow
>>
>>54700824
I get what ure trynna say, but it doesn't solve the original problem
which should output n if by none
>>
Anyone who gets a job via anything having to do with fizzbuzz, or any other meme CS 101 algo puzzle solving crap, is landing themselves square into a job that I wouldn't want in a million years at a company you couldn't pay me any sum of money to work at.
>>
>>54700679
>Isn't that exactly the point? Isn't that the test?
No, the point is to figure out if you can write a basic program AT ALL. It's not a trap to weed out programmers who don't program "the right way".

>except that's not the case.
Nobody cares that you can write a perfect implementation of a useless program. Nobody wants to hire a programmer who sees software development work as nothing but a series of "case tests" which he has to "solve" perfectly.
>>
>>54700958
>nobody wants an actual programmer that can think with their head

thank u com agen
t. Pajeet
>>
        for(int i = 1; i <= 100; i++){
String out = "";
out += (i % 3) == 0 ? "fizz" : "";
out += (i % 5) == 0 ? "buzz" : "";
System.out.println(!out.isEmpty() ? out : i);
}
>>
>>54700747
Some of those?

I'm pretty sure all 5 of them compile and work.

Maybe not though, I wrote them all over a year ago.
>>
>>54700973
You're proving my point, because people are hiring the indians.

They're not hiring the autists obsessed with writing "perfect" code for their hobby programs that nobody uses.
>>
>>54700942
I'm the same author of this post. Here just to not be a total stick in the mud:
'use strict';
let i = 0;
while (i++ < 101) {
console.log(i % 3 === 0 ? i % 5 === 0 ? 'FizzBuzz' : 'Fizz' : i % 5 === 0 ? 'Buzz' : i);
}
>>
File: 2dd.jpg (15 KB, 300x300) Image search: [Google]
2dd.jpg
15 KB, 300x300
>>54698007
I can not get it to compile

I have not used java in forever send help

$ javac fb.java 
fb.java:1: error: class, interface, or enum expected
public static void main(String[] args) {
^
fb.java:2: error: class, interface, or enum expected
for (int i = 1; i <= 100; i++) {
^
fb.java:2: error: class, interface, or enum expected
for (int i = 1; i <= 100; i++) {
^
fb.java:5: error: class, interface, or enum expected
}
^
fb.java:8: error: class, interface, or enum expected
}
^
fb.java:11: error: class, interface, or enum expected
}
^
6 errors

>>
>>54700306
it's not about historical value, it's to make it concise. in fact, there is very little in the way of historical features in Haskell compared to Java or C. mapM_ means map an action over a list and dispose the result (essentially compute an action for every element of a list). [a..b] means the list from a to b (and every item in between). putStrLn is basically print with a newline in other languages. the dot is just to compose functions together (like in math)
>>
>>54698007
Wtf you retard
Why are printing the numbers alongside
>>
> fizzbuzz test

if they always do that same test then what the fuck are they testing?
>>
>>54701084
>map

lol. Fold masterrace.

OP, the trick of the FizzBuzz test is to realize your first if statement is redundant
>>
>>54700110
#include <stdio.h>
#define F(x,y) printf("%s",i%x?"":#y"zz")
int main(int i){for(--i;i++^100;puts(""))F(3,Fi)|F(5,Bu)||printf("%i",i);return 0;}

>not using #defines to fuck things up even more
>>
Stand aside everyone
       IDENTIFICATION        DIVISION.
PROGRAM-ID. fizzbuzz.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CNT PIC 9(03) VALUE 1.
01 REM PIC 9(03) VALUE 0.
01 QUOTIENT PIC 9(03) VALUE 0.
PROCEDURE DIVISION.
*
PERFORM UNTIL CNT > 100
DIVIDE 15 INTO CNT GIVING QUOTIENT REMAINDER REM
IF REM = 0
THEN
DISPLAY "FizzBuzz " WITH NO ADVANCING
ELSE
DIVIDE 3 INTO CNT GIVING QUOTIENT REMAINDER REM
IF REM = 0
THEN
DISPLAY "Fizz " WITH NO ADVANCING
ELSE
DIVIDE 5 INTO CNT GIVING QUOTIENT REMAINDER REM
IF REM = 0
THEN
DISPLAY "Buzz " WITH NO ADVANCING
ELSE
DISPLAY CNT " " WITH NO ADVANCING
END-IF
END-IF
END-IF
ADD 1 TO CNT
END-PERFORM
DISPLAY ""
STOP RUN.
>>
>>54701312
This rofl
Ironically, OP failed
>>
>>54698361
It's a low hanging fruit. Mild reading comprehension and basic analytical skills get you through it unscathed. Coder Radio's Michael Dominic, who is only usually wrong, keeps complaining about interns failing it so hard that he only looks for the modulo operation for passing criteria.
>>
>>54701076
Did you put it in a class named fb?
>>
>>54701520
I copied OPs code verbatim
>>
>>54701534
Java needs a class definition. You really need to read more.
>>
>>54700463
Already made it, so here's my Python 3 version

for i in range(1, 101):
if (i % 3) == 0 and (i % 5) == 0:
print('fizzbuzz')
elif (i % 3 ) == 0:
print('fizz')
elif (i % 5) == 0:
print('buzz')
else:
print(i)


>>54700193
Nearly, the code tags are square brackets. Here's your code again

count = 0

while (count < 101):
if (count % 5) == 0 and (count % 3) == 0:
print "FizzBuzz"
count = count +1
elif (count % 3) == 0:
print "Fizz"
count = count + 1
elif (count % 5) == 0:
print "Buzz"
count = count +1
else:
print count
count = count + 1

>>
>>54701546
Is not OP's public var static usr(string args<>){}-blob a class definition though?
>>
It's an american thing to fail at fizzbuzz, in Europe anyone who passed a programming course in highschool can write it. How is it possible to accomplish any work if you can't write code? Are their bosses stupid?
>>
>>54700110
what le fuq
>>
>>54701036
my second submission to thread
'use strict';
let i = 0;
while(i++ < 100) {
const outs = [i,'Fizz','FizzBuzz','Buzz'];
let test = 0;
i % 3 === 0 && (test++);
test === 1 && (i % 5 === 0) && (test++);
test === 0 && (i % 5 === 0) && (test = 3);
console.log(outs[test]);
}
>>
>>54701933
the bonus with JS being, you can copy & paste my code into the chrome dev tools console and check my work! :D
>>
>>54701588
That's a method definition.
>>54701438
COBOL is witchcraft
>>
>>54702143
goddamn I remember now

fucking java
>>
>>54698007
Your code is fucking awful. Learn to logic.
>>
>>54698320
It IS printing the numbers:
>Write a program that prints the numbers >from 1 to 100. But for multiples of three >print "Fizz" instead of the number and >for the multiples of five print "Buzz". For >numbers which are multiples of both >three and five print "FizzBuzz".
Thread replies: 136
Thread images: 10

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.