[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]

>it says here that you can't do fizzbuzz without if else

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: 26
Thread images: 3

File: some tranny whore.jpg (57KB, 640x640px) Image search: [Google]
some tranny whore.jpg
57KB, 640x640px
>it says here that you can't do fizzbuzz without if else statements
>care to explain this?
>>
>>56490928
kys?
>>
10 print "fizz"
wait 4
beep
print "buzz"
goto 10
>>
>>56490955
fortran?
>>
>>56490928
switch...
>>
File: fizzbuzz_of_the_christ.png (402KB, 1024x768px) Image search: [Google]
fizzbuzz_of_the_christ.png
402KB, 1024x768px
You mean like this one?
>>
>>56490928
Easy, I lack experience.
That'S why I code in my free time, too.
So could you please leave me alone, so I can continue being a miserable pile of secrets?
>>
./fizzbuzz.sh
>>
>>56491012
Looks like basic desu senpai
i can tell from some of the pixels and the fact that print statements aren't formatted like that in fortran
>>
>>56490928
How long has she been on HRT? I want to be a tech emo girl too.
>>
>>56490928
(defun shiggylicious (n)
(dotimes (i n)
(format t "~%~:[~d~:;~:*~{~c~^~}~]"
(append (and (zerop (rem i 3)) (coerce "fizz" 'list))
(and (zerop (rem i 5)) (coerce "buzz" 'list)))
i)))
>>
File: her shey.jpg (105KB, 1000x1000px) Image search: [Google]
her shey.jpg
105KB, 1000x1000px
>>56491449
>she
>girl
>>
>>56491543
I'd totally cover her dick in hershey's and suck on that feminine penis
>>
>>56490928
# include <stdio.h>

int main ( ) {
int i=0;
A: ++i;
if (i - (i/3)*3 != 0)
{
goto B;}
printf("Fizz");
B: if (i-(i/5)*5 != 0)
{
goto C;}
printf("Buzz");
C:
if (i-(i/3)*3 !=0 && i-(i/5)*5!=0)
{
printf("%d", i);}

printf("\n");
if (i<100)
{
goto A;}
}

>>
>>56490928
I can do it just with if statements.
>>
>>56491563
You're using if else
>>56491661
Heh
>>
x=cellstr(int2str((1:100)'));
x(3:3:end)=cellstr('Fizz');
x(5:5:end)=cellstr('Buzz');
x(15:15:end)=cellstr('FizzBuzz');
fprintf('%s\n',x{:});
>>
>statement
EVRYTHING IS AN EPXPRESSSION YOU WHORE
>>
public static void main(String[] args){        
for(int i = 1; i <= 100; i++){
String test = "";
test += (i % 3) == 0 ? "fizz" : "";
test += (i % 5) == 0 ? "buzz" : "";
System.out.println(!test.isEmpty() ? test : i);
}
}
>>
>>56492215
That's literally just a shorthand if else statement.
>>
switch (i % 3) {
case 0: {
switch (i % 5) {
case 0: {
// Fizzbuzz
}
default: {
// Fizz
}
}
}
default: {
switch (i % 5) {
case 0: {
// Buzz
}
default: {
// Number
}
}
}
}
>>
Just use a visitor design pattern.
>>
#include <stdio.h>

static void num (int n) { printf("%d\n", n); }
static void fizz () { printf("Fizz\n"); }
static void buzz () { printf("Buzz\n"); }
static void fizzbuzz () { printf("Fizzbuzz\n"); }

int main (int argc, char *argv[]) {

void (*fp[4])(int n) = {num, fizz, buzz, fizzbuzz};

for (int i = 1; i <= 100; i++) {
fp[(!(i % 3)) + ((!(i % 5)) << 1)](i);
}
return 0;
}
>>
>>56490928
How big is Pistol's pistol?
>>
>>56491402
That's actually pretty cool. Forgot you could do that range selection in Python.
>>
for i in xrange(1,100): print 'FizzBuzz'[4*(i%3>0):8-4*(i%5>0)] or i
Thread posts: 26
Thread images: 3


[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.