He can't write FizzBuzz without using modular

Eli Nelson
Eli Nelson

he can't write FizzBuzz without using modular

Adrian Allen
Adrian Allen

modular

Ethan Rogers
Ethan Rogers

modulo

fuk, i had one job.

Logan Wright
Logan Wright

for (i = 1; i <= 100; ++i) {
int j = i;
while (j - 15 >= 0 ) j -= 15;
if (j == 0) printf ("FizzBuzz")
}

I don't feel like typing the rest of it out, but this is sort of how I did it in Casio BASIC

Juan Hall
Juan Hall

here's the Casio basic implementation using mod, originally I used another loop to do the mod with subtraction and remainder checking

For 1→A To 100 Step 1↵
MOD(A,15)→B↵
MOD(A,3)→C↵
MOD(A,5)→D↵

B=0⇒"FIZZBUZZ"↵
B=0⇒Goto 1↵
C=0⇒"BUZZ"↵
C=0⇒Goto 1↵
D=0⇒"FIZZ"↵
D=0⇒Goto 1↵

A◢
Goto 1

Lbl 1↵
Next

Robert Gonzalez
Robert Gonzalez

he uses Boolean Logic

Carson Bennett
Carson Bennett

How the fuck can you program anything without using boolean logic?
Demonstrate in pseudocode please

Luke Parker
Luke Parker

a = list(map(str, range(0, 100)))
for i in range(0, 100, 3):
a[i] = "Fizz"
for i in range(0, 100, 5):
a[i] = "FizzBuzz" if a[i] == "Fizz" else "Buzz"
print("\n".join(a))

Logan Diaz
Logan Diaz

being this much of a brainlet
kek

Anthony King
Anthony King

What's a fizzbuzz?

Brainlet networks student here.

The most complicated thing I have done is a bubble sort

Oliver Price
Oliver Price

google is not your enemy .. sort of

James Reyes
James Reyes

A basic CompSci exercise that gained fame because interviewers noticed that CompSci grads couldn’t figure out how to write a program that counts from 1-100 and replaces multiples of three, five and three and five with words.

Parker Scott
Parker Scott

int a = 1;
int b = 1;
for(int i = 1; i <= 100; i++){
if(i / 3 == a && i / 5 == b){
a++;
b++;
print("FizzBuzz");
} else if(i / 3 == a){
a++;
print("Fizz");
} else if(i / 5 == b){
b++;
print("Buzz");
} else { print(i) }
}

James Morgan
James Morgan

Cheers
If startpage and etc weren't slow as fuck I'd use those. Either its duckduckgo Jew or silicon valley Jews I guess

T. guy with Jew blood aware of their magic

Hudson Baker
Hudson Baker

    bool nbprint=false;
int fp=0;
for (int a=1;a<101;a++){
fp=a*1024;
nbprint=true;
if (((fp/3) & 1023)==0){printf("Fizz");nbprint=false;}
if (((fp/5) & 1023)==0){printf("Buzz");nbprint=false;}
if (nbprint){printf("%i ",a);}else{printf(" ");}
}
return 0;

Using the FPU

Austin Harris
Austin Harris

I was asked to fizzbuzz in an interview and I'd forgotten that the modulo operator existed because I hadn't written a line of code in over a year.

I made a 100 element array, lopped over it three time replacing the numbers with words in appropriate increments.

William Barnes
William Barnes

I hope you didn't get the job...

Joseph Cooper
Joseph Cooper

I don't need to know how to write things in a dumber fashion.

Jaxon Anderson
Jaxon Anderson

uses idiv
This is the same as modulus.
Though this is a relative clean replacement.

Wyatt Cox
Wyatt Cox

I read your post and imagined that STEM grad meme guy who holds a diploma

David Thompson
David Thompson

I don't know what meant but my guess is you could use predicate logic and write declarative programs like in prolog

Chase Evans
Chase Evans

var l3 = 0, l5 = 0;
for(var i = 1; i <= 100; i++) {
var out = "";
if(i == l3 + 3) {
l3 = i;
out += "Fizz";
}
if(i == l5 + 5) {
l5 = i;
out += "Buzz";
}
console.log(out ? out : i);
}

Parker Bennett
Parker Bennett

could've written fizz == 0 as !fizz too, oh well

Jose King
Jose King

yes
no
maybe

John Perez
John Perez

I have very little idea about programming, but maybe dividing by three and then checking if int(result) == result could work.

Jayden Rogers
Jayden Rogers


import fizzbuzz

fb = fizzbuzz.FizzBuzz()
fb.fizzbuzz(100)

Jeremiah White
Jeremiah White

Using IEEE 1164

Adam Howard
Adam Howard

You don't understand a single thing about programming. Who are you trying to kid, pajeet

Luke Young
Luke Young

It has a cycle of 15 so it's trivial to wrap 15 predefined prints in a loop.

Jonathan Diaz
Jonathan Diaz

Yeah, gotta unroll your loops for optimisation

Cameron Walker
Cameron Walker

He still has to solve FizzBuzz in his interviews
Junior dev detected

Oliver Thompson
Oliver Thompson

you can replace modulo as check divisibility check with

(n / d) * d == n

David Nelson
David Nelson

Won’t this just leave you with n = n?

Jason Hall
Jason Hall

fizz == 0 has better readability than !fizz in this case because fizz is not really a boolean. I'd also add an else after the first if so it skips checking the other ifs when fizz && buzz is true.

Andrew Phillips
Andrew Phillips

shouldn't if you make sure these are actual integers and not floats,

floor(n/d)*d == d
otherwise

Ethan Powell
Ethan Powell

even needing a programming language to write it

<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><style>p{counter-increment: item}p:not(:nth-of-type(5n)):before{content: counter(item)}p:nth-of-type(3n):before{content: "Fizz"}p:nth-of-type(5n):after{content: "Buzz"

Joseph Reyes
Joseph Reyes

not just doing it in your text editor

i1<Esc>qqyyp<Ctrl-A>[email protected]<Esc>[email protected]<Esc>[email protected]<Esc>[email protected]

Brayden Morris
Brayden Morris

#include <iostream>

using namespace std;

int main(void) {
for(int i = 1; i <= 20; i++){
switch(i){
case 1:
cout << "1" << endl;
break;
case 2:
cout << "2" << endl;
break;
case 3:
cout << "Fizz" << endl;
break;
case 4:
cout << "4" << endl;
break;
case 5:
cout << "Buzz" << endl;
break;
case 6:
cout << "Fizz" << endl;
break;
case 7:
cout << "7" << endl;
break;
case 8:
cout << "8" << endl;
break;
case 9:
cout << "Fizz" << endl;
break;
case 10:
cout << "Buzz" << endl;
break;
case 11:
cout << "11" << endl;
break;
case 12:
cout << "Fizz" << endl;
break;
case 13:
cout << "13" << endl;
break;
case 14:
cout << "14" << endl;
break;
case 15:
cout << "Fizzbuzz" << endl;
break;
case 16:
cout << "16" << endl;
break;
case 17:
cout << "17" << endl;
break;
case 18:
cout << "Fizz" << endl;
break;
case 19:
cout << "19" << endl;
break;
}
}

return 0;
}

What do I win?

David Peterson
David Peterson

a diploma

Disable AdBlock to view this page

Disable AdBlock to view this page

Confirm your age

This website may contain content of an adult nature. If you are under the age of 18, if such content offends you or if it is illegal to view such content in your community, please EXIT.

Enter Exit

About Privacy

We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. We also share information about your use of our site with our advertising and analytics partners.

Accept Exit