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 Revisions

4 of 6
added 131 characters in body
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 like Arnauld's answer. Thanks to digEmAll for the idea of using a stack to reverse the output.

Try it online!

Gymhgy
  • 8k
  • 12
  • 35

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