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

Write FizzBuzz in your fav lang

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: 147
Thread images: 22

File: 1495222236648.jpg (157KB, 800x1155px) Image search: [Google]
1495222236648.jpg
157KB, 800x1155px
  const fizzbuzz = function(n)
{
return Array.from({length:n},(_,i)=>i+1).map((n)=>n%15==0?'FizzBuzz':(n%3==0?'Fizz':(n%5==0?'Buzz':n)))
}
>>
>>60609142

(λ (x) (case-odd? x "fizz" "buzz"))
>>
apt install fizzbuzz
fizzbuzz -d 100
>>
var res = [1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz", 16, 17, "Fizz", 19, "Buzz", "Fizz", 22, 23, "Fizz", "Buzz", 26, "Fizz", 28, 29, "FizzBuzz", 31, 32, "Fizz", 34, "Buzz", "Fizz", 37, 38, "Fizz", "Buzz", 41, "Fizz", 43, 44, "FizzBuzz", 46, 47, "Fizz", 49, "Buzz", "Fizz", 52, 53, "Fizz", "Buzz", 56, "Fizz", 58, 59, "FizzBuzz", 61, 62, "Fizz", 64, "Buzz", "Fizz", 67, 68, "Fizz", "Buzz", 71, "Fizz", 73, 74, "FizzBuzz", 76, 77, "Fizz", 79, "Buzz", "Fizz", 82, 83, "Fizz", "Buzz", 86, "Fizz", 88, 89, "FizzBuzz", 91, 92, "Fizz", 94, "Buzz", "Fizz", 97, 98, "Fizz", "Buzz"];
for(var i=1, len=res.length; i<len; i++){
console.log(res[i]);
}
>>
>>60609212
0/10 no jqeury
>>
Fizbasz
Apology poor english.
>>
>>60609212
/thread
>>
>>60609188
That's not what fizz buzz is
>>
>>60609370

(λ (x) (case-fizz? x "fizz" "buzz"))

sperg
>>
>>60609142
Focking FizzBuzz, mate.
>>
Oдин
Двa
Физз
Чeтыpe
Бaзз
...
>>
>>60609142
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>
>>60609142
Made yours a bit more readable fampai.

const fizzbuzz = length =>
Array.from({length}, (_,i) => i + 1)
.map(n => n % 15 == 0 ? 'FizzBuzz'
: n % 3 == 0 ? 'Fizz'
: n % 5 == 0 ? 'Buzz' : n)
>>
>>60609142

what language is this?
>>
>>60609776
JavaScript
>>
>>60609832

I didn't know const meant anything in JS.
>>
from tutorial import fizzbuzz

try:
----fizzbuzz()
except:
----pass
>>
program fizzbuzz;
var i:integer;

begin
i:=1;
for i:=1 to 100 do
begin
if (i mod 15 = 0) then
writeln('FizzBuzz')
else if (i mod 5 = 0) then
writeln('Buzz')
else if (i mod 3 = 0) then
writeln('Fizz')
else
writeln(i);
end;
end.
>>
>>60609142
COBOLfag here. How do I code window?
Liek this?
>>
{ ⍵ 'Fizz' 'Buzz' 'FizzBuzz'[ +/1 2×0=3 5|⍵] }¨1+⍳100
>>
>>60610038
  ******************************************************************
* Author:Gary Niger *
* Date:2017, May the 27th *
* Purpose:FizzBuzz, what else? *
* Tectonics: cobc *
******************************************************************
IDENTIFICATION DIVISION.
*-*-*-*-*-*-*-*-*-*-*-*-*-
PROGRAM-ID. FIZZBUZZ.
*-*-*-*-*-*-*-*-*-*-*--
ENVIRONMENT DIVISION.
*-*-*-*-*-*-*-*-*-*-*--
CONFIGURATION SECTION.
*----------------------
INPUT-OUTPUT SECTION.
*----------------------
DATA DIVISION.
*-*-*-*-*-*-*-*-
FILE SECTION.
*-------------------------
WORKING-STORAGE SECTION.
*-------------------------
01 WS-DATA.
05 WS-COUNTS.
10 WS-FIRST PIC 9(4) VALUE ZERO.
10 WS-LAST PIC 9(4) VALUE 20.
10 WS-POSN PIC 9(4).
05 WS-RESULTS.
10 WS-RS00 PIC 9(4).
10 WS-RM05 PIC 9(4).
88 WS-ML05 VALUE ZERO.
10 WS-RM03 PIC 9(4).
88 WS-ML03 VALUE ZERO.
05 WS-DISPLAY-STRING PIC X(10).
05 WS-DISPLAY-NUM REDEFINES WS-DISPLAY-STRING.
10 WS-FIZZBUZZ-PRI PIC X(3).
10 WS-FIZZBUZZ-INT PIC Z(3)9.
10 WS-FIZZBUZZ-SUI PIC X(3).
05 WS-DISPLAY-ALPHA REDEFINES WS-DISPLAY-STRING.
10 WS-FIZZBUZZ-STR PIC X(10).
88 WS-IS-OTHER VALUE "* 0000 *".
88 WS-IS-FIZZ VALUE "* FIZZ *".
88 WS-IS-BUZZ VALUE "* BUZZ *".
88 WS-IS-FIZZBUZZ VALUE "*FIZZBUZZ*".
>>
>>60610038
>>60610105

*-*-*-*-*-*-*-*-*-*-*
PROCEDURE DIVISION.
*-*-*-*-*-*-*-*-*-*-*
MAIN-PROCEDURE.
PERFORM 10000-BEGIN
PERFORM 20000-MAIN
VARYING WS-POSN FROM WS-FIRST BY 1
UNTIL WS-POSN > WS-LAST
PERFORM 30000-END
.
STOP RUN.
*
10000-BEGIN.
DISPLAY "**********"
.
*
20000-MAIN.
PERFORM 40000-COMPUTE-FIZZBUZZ
DISPLAY WS-DISPLAY-STRING
.
*
30000-END.
DISPLAY "**********"
.
*
40000-COMPUTE-FIZZBUZZ.
DIVIDE WS-POSN BY 5 GIVING WS-RS00 REMAINDER WS-RM05
DIVIDE WS-POSN BY 3 GIVING WS-RS00 REMAINDER WS-RM03
EVALUATE TRUE
WHEN (WS-ML05 AND WS-ML03)
SET WS-IS-FIZZBUZZ TO TRUE
WHEN WS-ML05
SET WS-IS-BUZZ TO TRUE
WHEN WS-ML03
SET WS-IS-FIZZ TO TRUE
WHEN OTHER
SET WS-IS-OTHER TO TRUE
MOVE WS-POSN TO WS-FIZZBUZZ-INT
END-EVALUATE
.
*
END PROGRAM FIZZBUZZ.
That's it!
>>
with Ada.Text_IO;

procedure fizzbuzz2 is
fizz : INTEGER := 3;
buzz : INTEGER := 5;
begin
for i in 1..100 loop
fizz := fizz - 1;
buzz := buzz - 1;

Ada.Text_IO.Put(Integer'Image(i));
if fizz = 0 then
Ada.Text_IO.Put("Fizz");
fizz := 3;
end if;
if buzz = 0 then
Ada.Text_IO.Put("Buzz");
buzz := 5;
end if;
Ada.Text_IO.New_Line;
end loop;
end fizzbuzz2;

or
with Ada.Text_IO;

procedure fizzbuzz is
subtype fizz is INTEGER with dynamic_predicate => fizz mod 3 = 0;
subtype buzz is INTEGER with dynamic_predicate => buzz mod 5 = 0;
begin
for i in 1..100 loop
Ada.Text_IO.Put(Integer'Image(i));
if i in fizz then
Ada.Text_IO.Put("Fizz");
end if;
if i in buzz then
Ada.Text_IO.Put("Buzz");
end if;
Ada.Text_IO.New_Line;
end loop;
end fizzbuzz;
>>
for i in range(1,101): 
print("FizzBuzz"[i*i%3*4:8--i**4%5] or i)
>>
Have some enterprise Rust
#![feature(i128_type, conservative_impl_trait)]

use std::borrow::Cow;
use std::fmt;

#[derive(Copy, Clone)]
struct FizzBuzz(u128);

impl From<FizzBuzz> for Cow<'static, str> { //'
fn from(f: FizzBuzz) -> Self {
match (f.0 % 3, f.0 % 5) {
(0, 0) => "FizzBuzz".into(),
(0, _) => "Fizz".into(),
(_, 0) => "Buzz".into(),
_ => f.0.to_string().into(),
}
}
}

impl fmt::Display for FizzBuzz {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Cow::from(*self).fmt(f)
}
}

impl Iterator for FizzBuzz {
type Item = FizzBuzz;

fn next(&mut self) -> Option<Self> {
self.0 += 1;
Some(*self)
}
}

fn fizzbuzz(until: usize) -> impl Iterator<Item=FizzBuzz> {
FizzBuzz(0).take(until)
}

fn main() {
for f in fizzbuzz(100) {
println!("{}", f);
}
}
>>
File: 1489825231844.jpg (227KB, 1280x960px) Image search: [Google]
1489825231844.jpg
227KB, 1280x960px
>>60610184
That's pretty clever.
>>
>>60609142
Enumerable.Range(1, 100).Select(i => { return i % 5 == 0 ? (i % 3 == 0 ? "FizzBuzz" : "Buzz") : (i % 3 == 0 ? "Fizz" : i.ToString()); });
>>
main = mapM_ putStrLn fizzBuzz

fizzBuzz = zipWith (\a b -> if null b then show a else b) [1..100] $ zipWith (++) (cycle ["","","Fizz"]) (cycle ["","","","","Buzz"])
>>
>>60610321
Alternatively,
var dict = new Dictionary<int, string>()
{
{ 0, "{0}" },
{ 1, "Fizz" },
{ 2, "Buzz" },
{ 3, "FizzBuzz" }
};

for(int i = 1; i < 100; i++)
{
Console.WriteLine(dict[(0x1241843 & (3 << i % 15 * 2)) >> i % 15 * 2], i);
}
>>
>>60609142
using System;

namespace FizzBuzz
{
public class Program
{
public static void Main(string[] args)
{
for (int i = 1; i <= 100; i++)
{
Console.WriteLine(i % 15 == 0 ? "FizzBuzz" : i % 5 == 0 ? "Buzz" : i % 3 == 0 ? "Fizz" : i.ToString());
}
}
}
}
>>
>>60610555

Is this what C# looks like? I'm confused about namespaces, are they like Java packages?
>>
>>60610113
Respect!
>>
File: firefox_2017-05-27_21-06-59.png (35KB, 492x563px) Image search: [Google]
firefox_2017-05-27_21-06-59.png
35KB, 492x563px
Added the wait times because the cat talks too fast otherwise.
>>
>>60610589
if you change

 Console.WriteLine  

to

System.out.println

and delete stuff before public class



it became java code. ^_^
>>
(deffunction main-func()
(printout t "Enter a number: ")
(bind ?chosenNumber (read))
(loop-for-count (?i 0 ?chosenNumber) do
(if (=(mod ?i 15) 0)
then (printout t "FizzBuzz")
else (if (=(mod ?i 3) 0)
then (printout t "Fizz")
else(if (=(mod ?i 5) 0)
then (printout t "Buzz")
else (printout t ?i))))
(printout t crlf)))
(defrule sys-init => (main-func))

>>
>>60610589
Yes they're similar to java packages. They're just scopes you can use to keep things divided.
>>
>>60610661
impressive
can you get a job with scratch?

<html>
<ul>
<li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li><li>13</li><li>14</li><li>15</li><li>16</li><li>17</li><li>18</li><li>19</li><li>20</li><li>21</li><li>22</li><li>23</li><li>24</li><li>25</li><li>26</li><li>27</li><li>28</li><li>29</li><li>30</li><li>31</li><li>32</li><li>33</li><li>34</li><li>35</li><li>36</li><li>37</li><li>38</li><li>39</li><li>40</li><li>41</li><li>42</li><li>43</li><li>44</li><li>45</li><li>46</li><li>47</li><li>48</li><li>49</li><li>50</li><li>51</li><li>52</li><li>53</li><li>54</li><li>55</li><li>56</li><li>57</li><li>58</li><li>59</li><li>60</li><li>61</li><li>62</li><li>63</li><li>64</li><li>65</li><li>66</li><li>67</li><li>68</li><li>69</li><li>70</li><li>71</li><li>72</li><li>73</li><li>74</li><li>75</li><li>76</li><li>77</li><li>78</li><li>79</li><li>80</li><li>81</li><li>82</li><li>83</li><li>84</li><li>85</li><li>86</li><li>87</li><li>88</li><li>89</li><li>90</li><li>91</li><li>92</li><li>93</li><li>94</li><li>95</li><li>96</li><li>97</li><li>98</li><li>99</li><li>100</li></ul>
</html>


ul{
list-style-type:none;
}
li:nth-child(3n), li:nth-child(5n){
font-size:0px;
}

li:nth-child(3n):before{
font-size:16px;
content:"Fizz";
}
li:nth-child(5n):after{
font-size:16px;
content:"Buzz";
}
>>
>>60610198
Non-meme version:
fn main() {
for n in 1..101 {
match (n % 3, n % 5) {
(0, 0) => println!("FizzBuzz"),
(0, _) => println!("Fizz"),
(_, 0) => println!("Buzz"),
_ => println!("{}", n),
}
}
}
>>
>>60609188
>>60609419
What language is this?

Lisp?
>>
for(i in 1:100){
x <- NULL
if(i %% 3 == 0) x <- paste0(x, "Fizz")
if(i %% 5 == 0) x <- paste0(x, "Buzz")
if(is.null(x)) x <- i
cat(x, "\n")
}
>>
(1..100).each do |i|
str = String.new
if i % 3 == 0
str = "Fizz"
end
if i % 5 == 0
str += "Buzz"
end
if str.empty?
str = "#{i}" # or `str = i.to_s
end
end
>>
So you're just going from 1 to 100 and essentially having a few checks right? If it's divisible by 3, if it's by 5, if it's both, or none? Is it actually a question used in interviews? Seems kind of lame.
>>
3: fizz
5: buzz
1,100
>>
>>60612691
that should be
3:fizz
5:buzz
1,100

>create a language
>fuck up coding in it
oops
>>
Lua (pronounced 'Loo-ah') master race

for i = 1, 100 do
str = tostring(i)

if i % 3 == 0 then
str = "Fizz"
end

if i % 5 == 0 then
if tonumber(str) then str = "Buzz"
else
str = str .. "Buzz"
end
end

print(str)
>>
1.upto(100) { |i| p i % 5 == 0 ? (i % 3 == 0 ? "FizzBuzz" : "Buzz") : (i % 3 == 0 ? "Fizz" : i) }
>>
U0 FizzBuzz(I64 begin=1, I64 end=100) {
I64 i;
for(i=begin; i<=end; ++i) {
if(i%3 == 0) { "Fizz"; }
if(i%5 == 0) { "Buzz";}
if((i%3 != 0) && (i%5 != 0)) { "%d", i; }
"\n";
}
}
>>
>>60609142
フィズ バーズ
>>
>>60614565
FizzBuzz
>>
>>60610772
>not being a professional scratch programmer
>>
>>60609142
Print("fizzbuzz")
>>
#include <stdio.h>
void main(){
int i = 0;
int n = 9001;
for(i=0; i<n; i++){
if(i%2==0) printf("fizz\n");
else if(i%2!=0) printf("buzz\n");
else printf("fizzbuzz\n");
}
return "buzzed";
}
>>
>>60609848
It's part of the new JS features (ES6): constants and scoped variables.
>>
#include <stdio.h>

int main()
{
int i;

for (i = 0; i < 101; ++i)
{
i % 15 == 0 ? puts("FizzBuzz") : i % 5 == 0 ? puts("Buzz") : i % 3 == 0 ? puts("Fizz") : printf("%d\n", i);
}

return 0;
[\code]
>>
>>60609142
just a reminder, if you modulo terry hates you
>>
>>60610105

This is assembly?
>>
>>60616062
it puts the autism in awsembly
>>
What are questions that could be asked at an interview like fizzbutt?
>>
says "Fizz"x!($_%3)."Buzz"x!($_%)||$_ for 1..100
>>
>>60609991
My nigga
>>
>>60609510
бyзз*
>>
using System;

namespace FizzBuzz
{
class Program
{
public static void Main()
{
for (int i = 1; i <= 100; i++ ) Console.WriteLine((i % 3 == 0 || i % 5 == 0) ? ((i % 3 == 0 && i % 5 == 0) ? $"FizzBuzz: {i}" : ((i % 3 == 0) ? $"Fizz: {i}" : $"Buzz: {i}")) : i.ToString());
}
}
}
>>
>>60609671
You're not "a fuckin legend" !
>>
File: Untitled.png (16KB, 979x496px) Image search: [Google]
Untitled.png
16KB, 979x496px
@echo off
setlocal enableDelayedexpansion

for /l %%i in (1, 1, 100) do (
set /a fizz=%%i %% 3
set /a buzz=%%i %% 5
if !fizz!==0 set noecho=1&echo|set /p="Fizz"
if !noecho!==0 if !buzz!==0 set noecho=1&echo|set /p="Buzz"
if !noecho!==0 echo|set /p="%%i"
set noecho=0
echo|set /p=", "
)
>>
File: Untitled.png (17KB, 979x512px) Image search: [Google]
Untitled.png
17KB, 979x512px
>>60618443
@echo off
setlocal enableDelayedexpansion

echo|set /p="1"
for /l %%i in (1, 1, 100) do (
set /a fizz=%%i %% 3
set /a buzz=%%i %% 5
if !fizz!==0 if !buzz!==0 set noecho=1&echo|set /p="FizzBuzz"
if !noecho!==0 if !fizz!==0 set noecho=1&echo|set /p="Fizz"
if !noecho!==0 if !buzz!==0 set noecho=1&echo|set /p="Buzz"
if !noecho!==0 echo|set /p="%%i"
set noecho=0
echo|set /p=", "
)
>>
File: 2017-05-27-223729_237x720_scrot.png (10KB, 237x720px) Image search: [Google]
2017-05-27-223729_237x720_scrot.png
10KB, 237x720px
>>60612709
Finally got around to writing the interpreter. An empty file is shorthand for the classic fizzbuzz so empty file and the posted code both output like pic.
>>
>>60618518
3,7:foo
5:bar
1,40

outputs
$ ./fizzy.py test
1
2
foo
4
bar
foo
foo
8
foo
bar
11
foo
13
foo
foobar
16
17
foo
19
bar
foo
22
23
foo
bar
26
foo
foo
29
foobar
31
32
foo
34
barfoo
foo
37
38
foo
bar

I hope I can eventually find a use for this language aside from acting smarmy at interviews that ask a dumb question
>>
Bear witness to my wizardry! Kneel before me in utter awe!I have ascended!
#include <iostream>
#include <utility>

int main()
int range[100] ={};
for(int i =1; i<=100;i++) range[i-1]=i;

auto vglambda = [](auto printer) {
return [=](auto&& ts...){
printer(std::forward<decltype(ts)>(ts)...);
return [=] {
if(!(ts%15)) return printer("FizzBuzz");
else if(!(ts%3)) return printer("Fizz");
else if(!(ts%5)) return printer("Buzz");
else return printer(ts);
};
};
};

auto pred = vglambda(
[](int arr[]) {
for(auto i : arr) std::cout<<i<<std::endl;
}
);
auto execFizzBuzz = pred(range);
execFizzBuzz();

return 0;
}
>>
[kode]#include <iostream>
using namespace std;

int main (){
int min = 0;
int max = 100;
bool boolean = true;
for (int i = min; i <= max; ++i){
if(i%3==0){
cout << "Fizz";
boolean = false;
}
if (i%5==0)
cout << "Buzz";
boolean = false;
}
if (boolean)
cout << i;
if (!i==max){
cout << '\n';
boolean = true;
}
}
}
[/kode]
>>
File: dude_ur_getting_a_dell.jpg (17KB, 460x305px) Image search: [Google]
dude_ur_getting_a_dell.jpg
17KB, 460x305px
i <3 ruby

(1..100).each do |n|
print n unless (n % 3).zero? || (n % 5).zero?
print 'Fizz' if (n % 3).zero?
print 'Buzz' if (n % 5).zero?
puts ''
end
>>
File: file.png (442KB, 1756x1758px) Image search: [Google]
file.png
442KB, 1756x1758px
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>

1
100
15 0
"fizzbuzz"
3 0
"fizz"
5 0
"buzz"



1


>>
File: fizzbuzz.png (7KB, 257x300px) Image search: [Google]
fizzbuzz.png
7KB, 257x300px
>>60619474
>>
>>60616062
cobol
>>
>>60618990
My inspired ass wrote this on a whim correction

#g++ -v  6+
let cores=$( grep -c ^processor /proc/cpuinfo)
g++ std=c++14 -fpermissive -O2 -ftree-parallelize-loops=$cores -o FizzBuzzLambda.x FizzBuzzLambda.cpp


FizzBuzzLambda.cpp:
#include <iostream>
int main(){
int range[100] ={0};
for(int i =1; i<=100;i++) range[i-1]=i;
auto vglambda = [](auto ts) {
return [=](auto&& ts){
for(auto i=0;i<100;i++){
if(!(ts[i]%15)) std::cout<<"FizzBuzz"<<std::endl;
else if(!(ts[i]%3)) std::cout<<"Fizz"<<std::endl;
else if(!(ts[i]%5)) std::cout<<"Buzz"<<std::endl;
else std::cout<<ts[i]<<std::endl;
}
};
};
auto pred = vglambda(
[](int arr[]) {
for(auto i=0;i<100;i++) std::cout<<i<<std::endl;
}
);
pred(range);
return 0;
}
>>
$ sudo pip3 install fzzbzz
$ python3
>>> import fzzbzz
>>> fzzbzz(100)
>>
>>60610661
Are there no if else in scratch?
>>
>>60610660
Not my program, desu. ;-) I just wanted to give you the worst of the worst. I just changed the date and the name. XD
>>
>Write FizzBuzz in your fav lang

"FizzBuzz"
>>
File: 1390741004271.jpg (507KB, 724x2807px) Image search: [Google]
1390741004271.jpg
507KB, 724x2807px
>>60620596
>>
>>60609199
>apt install fizzbuzz
Permission denied.
>>
File: 1410954362969.png (297KB, 878x900px) Image search: [Google]
1410954362969.png
297KB, 878x900px
>>60615861
>stdio
>>
>>60609142
#!/bin/sh

iter() {
i=$1
max=$2
stp=$1
while [ $i -lt $max ]; do
str="$str $i "
i=$((i + $stp))
done
echo "$str $max"
}

for i in $(iter 1 100 1); do
if [ $((i % 3)) -eq 0 ] && [ $((i % 5)) -eq 0 ]; then
echo fizzbuzz
elif [ $((i % 3)) -eq 0 ]; then
echo fizz
elif [ $((i % 5)) -eq 0 ]; then
echo buzz
else
echo $i
fi
done
>>
File: 1481570185205.png (540KB, 457x639px) Image search: [Google]
1481570185205.png
540KB, 457x639px
>>60622947
>>
>>60615341
>Void
>Return something
Is there something I'm missing?
>>
File: Untitled.jpg (44KB, 487x489px) Image search: [Google]
Untitled.jpg
44KB, 487x489px
hey /g/ i don't know fizzbuzzing is pic related correct
>>
console.log("FizzBuzz");


Keep it simple faggots
>>
>>60609142
 
Scanner scan = new Scanner();
int n = scan.nextInt();
for(i = 0; i <= n; i++){
if(!(i%3)){
System.out.println("fizz");
}
elseif(!(i%5)){
System.out.println("buzz");
}
elseif(!(i%15)){
System.out.println("fizzbuzz");
}
else{
System.out.println(i);
}
}
>>
>>60622872
sudo apt install fizzbuzz
>>
>>60623364
void is an acceptable return type for main in c++, but it's frowned upon
>>
>>60623945
Oops swap the if(!(i%15)) statement with the if(!(i%3)) one
>>
echo FizzBuzz

>/thread
>>
File: 1467378493482.jpg (36KB, 400x460px) Image search: [Google]
1467378493482.jpg
36KB, 400x460px
Mine is English.

Solution: FizzBuzz

There.
>>
++++++++++[>++++++++++<-]>>++++++++++>->>>>>>>>>>-->+++++++[->++++++++
++<]>[->+>+>+>+<<<<]+++>>+++>>>++++++++[-<++++<++++<++++>>>]+++++[-<++
++<++++>>]>-->++++++[->+++++++++++<]>[->+>+>+>+<<<<]+++++>>+>++++++>++
++++>++++++++[-<++++<++++<++++>>>]++++++[-<+++<+++<+++>>>]>-->---+[-<+
]-<<[->>>+>++[-->++]-->+++[---<-->+>-[<<++[>]]>++[--+[-<+]->>[-]+++++[
---->++++]-->[->+<]>>[.>]>++]-->+++]---+[-<+]->>-[+>++++++++++<<[->+>-
[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->->+<<]>[-]>[<++++++[-
>++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]]<<<.<]
>>
File: fizzbuzz_idris.png (221KB, 1920x940px) Image search: [Google]
fizzbuzz_idris.png
221KB, 1920x940px
The only proven version itt.
>>

module Main where

main :: IO ()
main = printAll $ map fizzBuzz [1..100]
where
printAll [] = return ()
printAll (x:xs) = putStrLn x >> printAll xs

fizzBuzz :: Integer -> String
fizzBuzz n | n `mod` 15 == 0 = "FizzBuzz"
| n `mod` 5 == 0 = "Fizz"
| n `mod` 3 == 0 = "Buzz"
| otherwise = show n

>>
>>60609212
npm install fizzbuzzer


var fizzBuzzFunctionMethodModulized = require('fizzbuzzer');

fizzBuzzFunctionMethodModulized(100);


not sure about the modules name but its our there
>>
>>60625248
main :: IO ()
main = mapM_ (putStrLn . fizzbuzz) [1..100]

fizzbuzz :: Int -> String
fizzbuzz n
| n `rem` 15 == 0 = "FizzBuzz"
| n `rem` 5 == 0 = "Buzz"
| n `rem` 3 == 0 = "Fizz"
| otherwise = show n
>>
File: bf.webm (209KB, 838x481px) Image search: [Google]
bf.webm
209KB, 838x481px
>>60625206
let's try my brainfuck interpreter on "your" code.
>>
$i = 1;
while(1) {
if ($i%3 === 0) echo "fizz";
if ($i%5 === 0) echo "buzz";
if (!($i%3 === 0 || $i%5 === 0)) echo $i;
echo "\n";
$i++;
}


bring the hate :^)
>>
>>60625796
>infinite loop
>>
>>60625826
so? nobody defined a limit
>>
>>60625833
Alright we'll call you back later
>>
>>60625839
>actually applying to jobs that test you by fizzbuzz
lel, code monkeys are funny
>>
>>60625856
>not applying to jobs
NEETs are funny
>>
>>60625875
stop projecting
>>
100

https://github.com/EinBaum/FizzBuzz
keke
>>
>>60609212
Now create Angular2 app.
>>
>>60609510
Slavshit.
Slavs are not people.
>>
>>60625900
I had a bit of a similar idea but tried to generalize it a bit. I left in shorthand so that 100 or
#empty file but I don't trust 4chan code blocks
would also do the classic fizzbuzz.
https://github.com/iamevn/fizzy
>>
>>60610198
>using non standard i128
>enterprise
Also what the fuck is fizzbuzz fn actually returning?
>>
fizzBuzz i = if null desc then show i else desc where 
desc = concat [label | (j,label) <- tags, 0 == rem i j]
tags = [ (3,"Fizz"), (5,"Buzz"), (7,"Baz") ]

main = mapM_ (putStrLn . fizzBuzz) [1..120]
>>
>>60610113
I fucking love COBOL. Any similar langs?
>>
>>60628477
fizzbuzz() returns some type that implements the Iterator trait, with Iterator::Item = Fizzbuzz
>>
imageSubjectQuality=8/10;
wouldImpregnate=Y;
runNow
>>
>>60610151
>He doesn't know if the mod type
>>
public class Main
{
public static void main(String[] args){
int i;
for(i=1;i<101;i++){
if (i % 15 == 0){
System.out.println("FizzBuzz");
} else if (i % 5 == 0){
System.out.println("Buzz");
} else if (i % 3 == 0){
System.out.println("Fizz");
} else {
System.out.println(i);
}
}
}
}
>>
>>60625421
>>60625248
that's Caml ?
>>
def fizzbuzz(x):
if x / 3 = int:
Print("Fizz")
else:
Print("Buzz")
>>
>>60609142

Correcting my code:

def fizzbuzz(x):
if x / 3 = int:
Print(x, ", Fizz")
else:
Print(x, ", Buzz")
>>
>>60609142
OI CUNT JOT FIZZ IFINA DIVVY BY TREE ANNA BUZZ IFFA DIVVY BY YER WIVES AN IF ITS BOFF DO A FUCKING FIZZ BUZZ
>>
>>60610894
Lambda Calculus?
>>
>>60610772
>can you get a job with scratch?
Math teacher
>>
>>60630670
This >>60625421 is Haskell.
>>
>>60610894
Scheme I think. idr if using λ like that is specific to racket or scheme in general.
>>
File: asdasdasd.png (18KB, 327x274px) Image search: [Google]
asdasdasd.png
18KB, 327x274px
This is fucking cancer
>>
>>60622872
>he doesn't use su
get the fuck off my board
>>
let () =
let fizzbuzz x =
match (mod x 3, mod x 5) with
| (1, 1) -> "fizzbuzz"
| (0, 1) -> "buzz"
| (1, 0) -> "fizz"
| (0, 0) -> string_of_int x in
for i = 1 to 100 do
print_endline (fizzbuzz i) done;;
>>
>>60609142
A ← 25
{ω,(('' 'Fizz')[(0=3|ω)+1],('' 'Buzz')[(0=5|ω)+1])}¨(A 1⍴⍳A)

Generates an matrix, then runs the function over each value in it.
Returns an matrix where the first column shows the value, second if it's a fizz, third if Buzz.
>>
>>60609991
is that Pascal
>>
>>60632061
>ocaml is someone in the world favorite language
I don't trust you.
>>
>>60632399
what the fuck is this greek alphabet language? APL?
>>
>>60633629
Yeah it is. APL is objectively the best language.

{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
>>
File: hill.jpg (9KB, 228x219px) Image search: [Google]
hill.jpg
9KB, 228x219px
>>60612566
its the universal "please don't waste our time" question to weed out business majors trying to fake their way into programming because they heard tech is the hot industry to be in.
>>
function FizzBuzz ([int]$Count)
{
foreach($i in 1..$Count)
{
$x = ""
if($i % 3 -eq 0){ $x = $x + "Fizz" }
if($i % 5 -eq 0){ $x = $x + "Buzz" }
if($x -eq ""){ $i } else { $x }
}
}


>>60620920
Why would you want to use ifelse for FizzBuzz?
>>
File: drank.jpg (48KB, 800x800px) Image search: [Google]
drank.jpg
48KB, 800x800px
Messing around with Elm, but not too familiar with functional program. Which of the following is more "functionally pure," so to speak?

fizz n =
if n % 15 == 0 then
"FizzBuzz"
else if n % 5 == 0 then
"Buzz"
else if n % 3 == 0 then
"Fizz"
else
toString n

fizz2 n =
case (n % 3, n %5) of
(0, 0) -> "FizzBuzz"
(_, 0) -> "Buzz"
(0, _) -> "Fizz"
(_, _) -> toString n
>>
>>60636023
The second.
>>
>>60629785

>>60623945
>>60623982
>>
>>60633558
Yes
>>
'$lang: "qb"
10 LET X = 101
20 LET I = 1
30 IF I MOD 5 = 0 AND I MOD 3 = 0 AND I < X THEN
PRINT "FizzBuzz"
I = I + 1
GOTO 30
40 ELSEIF I MOD 5 = 0 AND I < X THEN
PRINT "Fizz"
I = I + 1
GOTO 30
50 ELSEIF I MOD 3 = 0 AND I < X THEN
PRINT "Buzz"
I = I + 1
GOTO 30
60 ELSEIF I < X THEN
PRINT I
I = I + 1
GOTO 30
70 ELSE
GOTO 80
80 END IF
90 SLEEP
>>
File: hqdefault.jpg (19KB, 480x360px) Image search: [Google]
hqdefault.jpg
19KB, 480x360px
>>60623954
anon is not in the sudoers file. This incident will be reported.
>>
https://pastebin.com/mEJg8V87
>>
https://raw.githubusercontent.com/iamevn/wordy/master/examples/fizzbuzz.txt
>>
    def fizz_buzz do
1..100
|> Enum.each(fn(n)->
case {rem(n, 5), rem(n, 3)} do
{0,0} -> "FizzBuzz"
{_,0} -> "Fizz"
{0,_} -> "Buzz"
{_,_} -> n
end
|> IO.puts
end)
end
>>
>>60636023
This language looks very nice.
Is it any good though?
>>
print("FizzBuzz")
>>
>>60633573
Why? It's a great language and the module system (which is a reason enough to use it) has no competition in other languages. I picked it up because Coq but i now write all my scripts and utilities that run as root in it.
Thread posts: 147
Thread images: 22


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