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

Time for board, write FizzBuzz program.

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 37
Thread images: 9

File: Whiteboard_with_markers.jpg (148KB, 1840x1123px) Image search: [Google]
Whiteboard_with_markers.jpg
148KB, 1840x1123px
Time for board, write FizzBuzz program.
>>
using(StreamReader r = new StreamReader("fizzbuzzoutput.txt")
{
Console.WriteLine(r.ReadToEnd());
}
>>
File: fizzbuzz.png (810KB, 1840x1123px) Image search: [Google]
fizzbuzz.png
810KB, 1840x1123px
>>
File: 1492185490833.jpg (231KB, 1840x1123px) Image search: [Google]
1492185490833.jpg
231KB, 1840x1123px
>>
>>59888810
How many fizzes can you buzz before you get a stack overflow?
>>
#include <stdio.h>

int
main(int argc, char **argv)
{
if(argc < 2){
printf("usage: %s [ n ]\n", argv[0]);
return 1;
}
else if(argc == 3)
return 0; /* done */
else if(argc == 2){
argc = 3 + atoi(argv[1]);
return main(argc, argv);
}
argc -= 3;

if(argc%3 == 0){
if(argc%5 == 0)
printf("bucksfizz, ");
else
printf("bucks, ");
}
else if(argc%5 == 0)
printf("fizz, ");
else
printf("%d, ", argc);
return main(argc+2, argv);
}
>>
>>59888885
kys

public class FizzBuzz {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
String item = (i % 3 == 0) ? "fizz" : "";
item += (i % 5 == 0) ? "buzz" : "";
item = (item.isEmpty()) ? String.valueOf(i) : item;
System.out.println(item);
}
}
}
>>
>>59888818
Script kiddy
>>
File: FizzBuzz.png (63KB, 727x576px) Image search: [Google]
FizzBuzz.png
63KB, 727x576px
>>59888763
>>
>>59888810
the fuck is that???
>>
>>59888983
Sexy
>>
bool flag = false;
bool flag1 = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
int num = 1;
Label0:
int num1 = 302782211;
while (true){
switch (num1 ^ 302782217){
case 0:{ Console.WriteLine(num); num1 = 302782216; continue; }
case 1:{ num1 = 302782210; continue; }
case 2:{ num1 = 302782213; continue; }
case 3:{ num1 = 302782216; continue; }
case 4:{ num1 = (flag4 ? 302782215 : 302782217); continue; }
case 5:{ num1 = 302782216; continue; }
case 6:{ flag2 = flag & flag1; num1 = 302782234; continue; }
case 7:{ flag = num % 3 == 0; flag1 = num % 5 == 0; num1 = 302782223; continue; }
case 8:{ Console.WriteLine("FizzBuzz"); num1 = 302782219; continue; }
case 9:{ flag3 = flag; num1 = 302782212; continue; }
case 10:{ num1 = 302782235; continue; }
case 11:{ num++; num1 = 302782235; continue; }
case 12:{ num1 = 302782216; continue; }
case 13:{ num1 = (flag3 ? 302782214 : 302782232); continue; }
case 14:{ Console.WriteLine("Buzz"); num1 = 302782220; continue; }
case 15:{ Console.WriteLine("Fizz"); num1 = 302782218; continue; }
case 16:{ goto Label0; }
case 17:{ flag4 = flag1; num1 = 302782221; continue; }
case 18:{ if (num <= 100) { goto case 7; } break; }
case 19:{ num1 = (!flag2 ? 302782208 : 302782209); continue; }
default:{ goto case 18; }
}
}
>>
for i in range(100):
fizz = "" if i%3 else "fizz"
buzz = "" if i%5 else "buzz"
print(fizz+buzz if fizz or buzz else i)
>>
File: fizz.png (1MB, 1840x1123px) Image search: [Google]
fizz.png
1MB, 1840x1123px
hey?? is this ok?? thx
>>
>>59889375
>>59889180
>>59889078
>>59888983
>>59888935
>>59888885
>>59888810
>>59888779
Are you too dense to understand the purpose of whiteboard coding?

It's supposed to take away syntax highlighting and any other crutches your editor / IDE provides.
>>
>>59889697
>too blind to see the different colored pencils
>>
>>59889180
>range(100)
F.
>>
>>59889937
What, is the range supposed to be different?
I never bothered to remember the exact rules.
>>
>>59890023
xrange
>>
>>59890023
How do you write in a language and not know its number position? Python has zero-based numbering. E.g. lst[0] is in fact the first index.
>>
>>59890023
It's python3, range is the old xrange.
>>
>>59890088
I'm not talking about the language, I'm talking about the rules of fizzbuzz.
I have no idea at which number it's supposed to start, and I even had to read the above posts to figure out the 3 & 5.
>>
>>59888763
for (int i = 1; i < 100; ++i) {
int fizz = i % 3 == 0;
int buzz = i % 5 == 0;

if (fizz || buzz) {
if (fizz) printf("fizz");
if (buzz) printf("buzz");
printf("\n");
} else {
printf("%d\n", i);
}
}
>>
File: Capture.png (5KB, 376x227px) Image search: [Google]
Capture.png
5KB, 376x227px
Rate me on my sins
>>
>>59888763
base64 -d | gunzip <<EOF
H4sIAGUS8VgAA03Nuw3EMAwD0J7b6GN92hTZ5Qa4JtPnYAs4VqYpEE+guD/PA8f1/T07J+qEXYmc
jxjEdzx1QHIuTWNVqNFcY/qC9n9uAhva2LaEse6ju8FJ94CP7qwvxWJ9jb4Ki/QQxOjBeiSC9Rw9
DUl6BnL0ZL0UxXqNXoUivQU9erPeiWb9Bb19h7OdAQAA
EOF
>>
>>59889721
> autistic enough to syntax highlight by hand

This isn't ALGOL 60 bruh.
>>
File: whiteboard.jpg (157KB, 1840x1123px) Image search: [Google]
whiteboard.jpg
157KB, 1840x1123px
>>
var
i: Integer;

begin
for i := 1 to 100 do
begin
if ((i mod 3) and (i mod 5)) = 0 then
Writeln('FizzBuzz');
if (i mod 3) = 0 then
Writeln('Fizz')
else if (i mod 5) = 0 then
Writeln('Buzz')
else
Writeln(i);
end;
Readln();
end.
>>
#include <stdio.h>

#define N if (printf ("%d\n", n++) < 0) goto error
#define PRINT(s) if (printf (s"\n") < 0) goto error; n++
#define FIZZ PRINT ("fizz")
#define BUZZ PRINT ("buzz")
#define FIZZBUZZ PRINT ("fizzbuzz");

int main (void) {
int n;
n = 0;
loop:
FIZZBUZZ;
N;
N;
FIZZ;
N;
BUZZ;
FIZZ;
N;
N;
FIZZ;
BUZZ;
if (n == 101) goto end;
N;
FIZZ;
N;
N;
goto loop;
end:
return 0;
error:
fprintf (stderr, "failed to printf\n");
return 1;
}
>>
Here you go:
let o = (i) => {console.log(i % 15 == 0 ? 'FizzBuzz' : (i % 5 == 0 ? 'Buzz' : (i == 0 % 3 ? 'Fizz' : i))); i < 100 ? o(i += 1) : () => {}}; o(1)
>>
>>59891077
oops little typo here's the correct one:
let o = (i) => {console.log(i % 15 == 0 ? 'FizzBuzz' : (i % 5 == 0 ? 'Buzz' : (i % 3 == 0 ? 'Fizz' : i))); i < 100 ? o(i += 1) : () => {}}; o(1)
>>
File: temp1492185490833.png (1002KB, 1840x1123px) Image search: [Google]
temp1492185490833.png
1002KB, 1840x1123px
>>59888763
Here's actual whiteboard coding
>>
Compiled on free mode. Dirty as fuck but it works.
IDENTIFICATION DIVISION.
PROGRAM-ID. FIZZBUZZ.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FIZZ PIC S9(4) BINARY.
01 BUZZ PIC S9(4) BINARY.
01 TRASH PIC S9(4) BINARY.
01 I PIC S9(4) BINARY.
PROCEDURE DIVISION.
PERFORM VARYING I FROM 1 BY 1
UNTIL I > 100
DIVIDE I BY 3 GIVING TRASH REMAINDER FIZZ
DIVIDE I BY 5 GIVING TRASH REMAINDER BUZZ
IF FIZZ = ZERO AND BUZZ = ZERO
DISPLAY 'FIZZBUZZ'
ELSE IF FIZZ = ZERO
DISPLAY 'FIZZ'
ELSE IF BUZZ = ZERO
DISPLAY 'BUZZ'
ELSE DISPLAY I
END-IF
END-IF

END-PERFORM.
STOP RUN.

>>
>>59891141
0/10 you failed.
>>
>>59889697
>syntax highlighting
>a crutch
I think the purpose is to show if how well you can hold the solution in your memory actually
>>
File: 1492185490833.jpg (429KB, 1840x1123px) Image search: [Google]
1492185490833.jpg
429KB, 1840x1123px
>>59888763
here!
>>
>>59891212
sorry forgot to print a seperator, just add a printf \n at the end of a loop..
Thread posts: 37
Thread images: 9


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.