Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Fizzbuzz


ghost's Avatar
0 0

Yep.. FizzBuzz

To tell if programmers are problem solvers <–edit..

I'm wondering how many people can do this…

What is fizzbuzz?

Its basically a program that counts from 1 through to 100 and for every multiple of three it prints "Fizz" and for Every multiple of 5 it prints "Buzz" for every multiple of 5 and 3 it prints "FizzBuzz"

Doesnt matter what language its in..

So c'mon people lets see some of that code :p


Uber0n's Avatar
Member
0 0

Darth_Pengo wrote: Its basically a program that counts from 1 through to 100 and for every multiple of three it prints "Fizz" and for Every multiple of 5 it prints "Buzz" for every multiple of 5 and 3 it prints "FizzBuzz"

… Are you kidding?:right:


ghost's Avatar
0 0

Uber0n wrote: [quote]Darth_Pengo wrote: Its basically a program that counts from 1 through to 100 and for every multiple of three it prints "Fizz" and for Every multiple of 5 it prints "Buzz" for every multiple of 5 and 3 it prints "FizzBuzz"

… Are you kidding?:right:[/quote]

no…… its possible…


ghost's Avatar
0 0

@usmcrreed19 man seriously what is wrong with you all he said is that if you could make the program like that he didn't insult any programmer or anyone while you just went out of your way to swear at him, you talking about being childish well im afraid you are the most childish one in this case.

Ask yourself did he do something wrong by posting that, first of its not annoying because seriously you didn't have to read it but you chose to read it so if you found it annoying well that is your own fucking fault get a life no one told you sit down and read his post.

you can exclude the fizz,buzz stuff and well just think of it as a program that prints out one type of word at a multiple of for example 5 and another type of word at a multiple of for example 3.

Thirdly its not good to insult a person before you did what they asked you too for example if you showed that you done the code and that it was easy then you could then say then "yeh that was really easy and personally a waste of time to do" but you didn't.

Lastly keep you mouth shut if you have nothing good to say as an old saying goes that we all would have heard at least once in our lives.

That is all.


ghost's Avatar
0 0

I think his post was directed at the ton of spam posts posted before his. An Admin deleted them, but left his, which messed up the order.


ghost's Avatar
0 0

for ( $i = 1; $i &lt;= 100; ++$i )
{
	echo &quot;$i: &quot;;
	if ( $i % 3 == 0 )
		echo &quot;Fizz&quot;;
	if ( $i % 5 == 0 )
		echo &quot;Buzz&quot;;
	echo &quot;&#92;n&quot;;
}

?&gt;```

ghost's Avatar
0 0

Hey, no I wasn't swearing at all of you, I was swearing at the individual who was flaming hbh, by posting in every forum, FREE ZEEK,….. Thats what I was referring to….. sorry….. I wasn't flaming everyone else…. I was flaming when most of the forums were posted on by those individuals that put the pic of system's post, and put free zeek in green at the bottom…..


ghost's Avatar
0 0

@usmcrreed19 sorry if i was harsh on you man i didn't realise that some previous posts were deleted and i didn't know to whoms' post you were referring too once again i apoligise:)


ghost's Avatar
0 0

well heres my little fizzbuzz it does everything right except it prints the value of i as well as fizz,buzz or fizzbuzz and i don't know how to make it stop doing this so if any other C++ programmer looks at it and tell me the fault i have made in it that would be great, but apart from that little detail it took me about 2 mins to type up it up so yeh.

#include <iostream> #include <string> using namespace std;

int main () { int i; for (i=0;i<101;i++) { if (i%5==0 && i%3==0) { cout << "fizzbuzz" << endl; } else if (i%3==0) { cout << "Fizz" << endl; } else if (i%5==0) { cout << "buzz" << endl; } cout <<i<<", "; } return 0; }


Uber0n's Avatar
Member
0 0

Darth_Pengo wrote: no…… its possible…

Yeah of course it is. No offense, but I just meant that this isn't enough to see if a programmer really knows how to code :p


ghost's Avatar
0 0

@ubernon yeh it isn't enough to tell if a programmer is good at programming or if he is infact a good programmer it is designed at to more look at a basic problem solving example since programming involves alot of problem solving so it does hint upon what a programmer is capable of and what for example an employer can expect from him.


ghost's Avatar
0 0

A good programmer should be able to code a script to pass the turing completeness test


jaggedlancer's Avatar
The Localhost Hacker
20 0

I used to play this game in maths class i loved it, it had slightly different rules though.

Every multiple of 3 you say trizz Every multiple of 5 you say fizz Every multiple of 10 you say buzz And if its a multiple of more than one you say both And if it isnt a multiple of any you jsut say the number :happy:


jaggedlancer's Avatar
The Localhost Hacker
20 0

No you wrong did you ever play it with mr atherton? My way is the way he used to play it :happy:

[edit]Thats also why i said "it had slightly different rules though."[/edit] :D


ghost's Avatar
0 0

Uber0n wrote: Darth_Pengo wrote: no…… its possible…

Yeah of course it is. No offense, but I just meant that this isn't enough to see if a programmer really knows how to code :p

Yeah I wasnt thinking when i wrote the post I changed it now


ghost's Avatar
0 0

haha i payed the fizzbuzz program when i was a kid to in primary school we had to learn a second language which was german and we had to say fizz on multiples of 3 and buzz on multiples of 5 and if it was the mutiple of both we said fizzbuzz except offcourse we counted in german hehe


ghost's Avatar
0 0

haha nice ^^


ghost's Avatar
0 0

In VB.Net:

Module FizzBuzz

Sub Main()

Dim x as Integer Dim str as String = ""

For x = 1 to 100 If x Mod 3 = 0 Then str &= "fizz" If x Mod 5 = 0 Then str &= "buzz" System.Console.WriteLine(str) str = "" Next

End Sub

End Module