Write a fizzbuzz program in a language you've never used before. It's not hard, but I assume that if you come up with difficult challenges, people won't do them.
Name:
Anonymous2018-04-15 17:39
var fizzbuzz = require('fizzbuzz').fizzbuzz; for(var i=1;i<=100;i++){ console.log(String(fizzbuzz(i))); } Thanks npm
Name:
Anonymous2018-04-16 7:42
fun main() { for(i := 1; i <= 100; i++) { fizzbuzz(i); } }
fun fizzbuzz() { var fizz = !(i % 3); var buzz = !(i % 5); if (fizz && buzz) echo("fizzbuzz"); else if (fizz) echo("fizz"); else if (buzz) echo("buzz"); else echo(i); }
Name:
Anonymous2018-04-16 11:16
public class FizzBuzz { public static void main(String[] args) { for (int i = 1; i <= 100; i++) { boolean fizzOrBuzz = false; if (i % 3 == 0) { System.out.print("Fizz"); fizzOrBuzz = true; } if (i % 5 == 0) { System.out.print("Buzz"); fizzOrBuzz = true; }
It doesn’t count if you have a separate case for “fizzbuzz” instead of just one for fizz and one for buzz. You should consider appending to a string. And a Boolean helps too.
// Get the string of Fizz @Override public String getValue() { if (isFizzValid) { // Is Fizz return getFizz(); } else { // Is not Fizz return null; } } }
class Buzz implements Quux { public boolean isBuzzValid; static String buzz;
if (fizzValue == null && buzzValue == null) { throw new NoFizzBuzzException("No fizzbuzz"); } else { String value = ""; if (fizzValue != null) { value = value + fizzValue; } if (buzzValue != null) { value = value + buzzValue; }
return value; } } }
class FizzBuzzCalculator { public int fizzDiscriminator; public int buzzDiscriminator; public int zero; // Zero public int numberToCalculate;
public FizzBuzzCalculator(int number) { fizzDiscriminator = 3; buzzDiscriminator = 5; zero = 0; numberToCalculate = number; }
public FizzBuzzFactory calculate() { boolean fizzValid; boolean buzzValid;
>>13 Looks good Can I interest you in a $80k job position as lead code monkey?
Name:
Anonymous2018-04-16 18:17
>>13 I LOVE YOU! I LOVED YOUR POST! I READ IT FIVE TIMES! KEEP POSTING! Maybe a new challenge should be to over-engineer simple programs and see how long you can make them without adding random bullshit
Name:
Anonymous2018-04-17 1:55
it's shit. just started learning Haskell.
fizzbuzz :: (Integral a, Show a) => [a] -> [String] fizzbuzz [] = [] fizzbuzz (x:xs) = let fbLine = [(if mod x 3 == 0 then "fizz" else "") ++ (if mod x 5 == 0 then "buzz" else "") ++ show x] in fbLine ++ fizzbuzz xs
main = do mapM_ putStrLn $ fizzbuzz [1..100]
Name:
Anonymous2018-04-17 3:21
with Ada.Text_IO; use Ada.Text_IO; procedure FizzBuzz is package Positive_IO is new Integer_IO(Positive); use Positive_IO; Print_Number : Boolean; function Divides(M, N : Positive) return Boolean is (N mod M = 0); procedure Test(B : Boolean; S : String) is begin if B then Put(S); Print_Number := False; end if; end Test; begin for I in 1..100 loop Print_Number := True; Test(Divides(3, I), "Fizz"); Test(Divides(5, I), "Buzz"); if Print_Number then Put(I, Width => 0); end if; New_Line; end loop; end FizzBuzz;
Name:
Anonymous2018-04-17 5:42
>public String getValeu() >String fizzBuzzValue = factory.getValeu(); It will not compile
A custom console FizzBuzz in C11 you have to run it with ./a.out 1 101 3:Fizz 5:Buzz #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <stdbool.h> typedef struct fb_denom_str{uint64_t denom;char str[256];}fb_denom_str;