Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 51 characters in body
Source Link
Gymhgy
  • 8k
  • 12
  • 35

C# (Visual C# Interactive Compiler), (削除) 180 (削除ここまで) 171(削除) 171 (削除ここまで) 168 bytes

n=>{for(int i=1,p;i<5001;){p=i;varvar j=new Stack<int>();for(;p>0;pp=i;p>0;p/=n)j.Push(p%n);var s=i%s=i%~(n/2+12)<1?"Fizz":"";Print(i++%((n+8n+11)/3+13)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online! Saved 3 bytes thanks to ceilingcat

Try it online!

C# (Visual C# Interactive Compiler), (削除) 180 (削除ここまで) 171 bytes

n=>{for(int i=1,p;i<5001;){p=i;var j=new Stack<int>();for(;p>0;p/=n)j.Push(p%n);var s=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online!

C# (Visual C# Interactive Compiler), (削除) 180 (削除ここまで) (削除) 171 (削除ここまで) 168 bytes

n=>{for(int i=1,p;i<5001;){var j=new Stack<int>();for(p=i;p>0;p/=n)j.Push(p%n);var s=i%~(n/2)<1?"Fizz":"";Print(i++%((n+11)/3)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Saved 3 bytes thanks to ceilingcat

Try it online!

deleted 24 characters in body
Source Link
Gymhgy
  • 8k
  • 12
  • 35

C# (Visual C# Interactive Compiler), 180(削除) 180 (削除ここまで) 171 bytes

n=>{for(int i=1,p;i<5001;){p=i;var s="";var j=new Stack<int>();while;for(p>0;p>0;p/=n)j.Push(p-(p/=n)*np%n);s+=i%;var s=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online! Try it online!

C# (Visual C# Interactive Compiler), 180 bytes

n=>{for(int i=1,p;i<5001;){p=i;var s="";var j=new Stack<int>();while(p>0)j.Push(p-(p/=n)*n);s+=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online!

C# (Visual C# Interactive Compiler), (削除) 180 (削除ここまで) 171 bytes

n=>{for(int i=1,p;i<5001;){p=i;var j=new Stack<int>();for(;p>0;p/=n)j.Push(p%n);var s=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online!

added 131 characters in body
Source Link
Gymhgy
  • 8k
  • 12
  • 35

C# (Visual C# Interactive Compiler), 180 bytes

n=>{for(int i=1,p;i<5001;){p=i;var s="";var j=new Stack<int>();while(p>0)j.Push(p-(p/=n)*n);s+=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs just like ArnauldArnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online! Try it online!

C# (Visual C# Interactive Compiler), 180 bytes

n=>{for(int i=1,p;i<5001;){p=i;var s="";var j=new Stack<int>();while(p>0)j.Push(p-(p/=n)*n);s+=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs just like Arnauld. Thanks to digEmAll for the idea of using a stack to reverse.

Try it online!

C# (Visual C# Interactive Compiler), 180 bytes

n=>{for(int i=1,p;i<5001;){p=i;var s="";var j=new Stack<int>();while(p>0)j.Push(p-(p/=n)*n);s+=i%(n/2+1)<1?"Fizz":"";Print(i++%((n+8)/3+1)<1?s+"Buzz":s==""?string.Join("-",j):s);}}

Outputs like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online!

added 6 characters in body
Source Link
Gymhgy
  • 8k
  • 12
  • 35
Loading
added 101 characters in body
Source Link
Gymhgy
  • 8k
  • 12
  • 35
Loading
Source Link
Gymhgy
  • 8k
  • 12
  • 35
Loading

AltStyle によって変換されたページ (->オリジナル) /