🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1197

Re: BizFuss (was Re: Taming The Switch-Statement)

#1197
From: Rosario19
Date: Sat, 31 Oct 2026 10:36
60 lines
3515 bytes
On Fri, 30 Oct 2026 08:27:59 -0000 (UTC), Lawrence DÿOliveiro wrote:

>On Thu, 29 Oct 2026 08:30:33 +0100, Rosario19 wrote:
>
>> for(x=1;x<20;++x)
>>   {if(x%2==0) printf("%d divides by 2\n",x);
>>    if(x%3==0) printf("%d divides by 3\n",x);
>>    if(x%3!=0&&x%2!=0)
>>            printf("%d no divides (by 3 or 2)\n",x);
>>   }
>
>Generalization I call “bizzfuzz” -- substitute whatever
>factors and limit you want:
>
>    factors = (2, 3, 5, 7) # factors to be checked in order
>    limit = 200
>
>    for n in range(1, limit + 1) :
>        i = (list(n % factors[j] == 0 for j in range(len(factors))) + [True]).index(True)
>        if i < len(factors) :
>            print("%d is divisible by %d" % (n, factors[i]))
>        else :
>            print("%d is not divisible by any of (%s)" % (n, ", ".join(str(f) for f in factors)))
>        #end if
>    #end for

In APL modulo translation is 80 characters, 1 line

2 3
7{leftbrace}a{leftarrow}{alpha}{diamond}{leftbrace}0={notequalunderbar}k{leftarrow}a/{dieresistilde}0=a{stile}{omega}:{quad}{leftarrow}{omega},{apostrophe}
is not divisible by
{apostrophe},a{diamond}{quad}{leftarrow}{omega},{apostrophe} is
divisible by
{apostrophe},k{rightbrace}{dieresis}{iota}{omega}{rightbrace}20


2 3 7{a¼©À{0=?k¼a/¡0=a|¹:²¼¹,' is not divisible by ',aÀ²¼¹,' is
divisible by ',k}¡°¹}20
1  is not divisible by  2 3 7
2  is divisible by  2
3  is divisible by  3
4  is divisible by  2
5  is not divisible by  2 3 7
6  is divisible by  2 3
7  is divisible by  7
8  is divisible by  2
9  is divisible by  3
10  is divisible by  2
11  is not divisible by  2 3 7
12  is divisible by  2 3
13  is not divisible by  2 3 7
14  is divisible by  2 7
15  is divisible by  3
16  is divisible by  2
17  is not divisible by  2 3 7
18  is divisible by  2 3
19  is not divisible by  2 3 7
20  is divisible by  2

Technical Details
Message-ID: <sggbel97ubc4ntngdfel9vlg7c7d2qpb2c@4ax.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$1@dont-email.me> <11bnfpm$i84l$1@dont-email.me> <11bng23$iblc$1@dont-email.me> <11bngj1$ifj5$1@dont-email.me> <11bnnbg$l7i1$1@dont-email.me> <11bntk0$nsbo$1@dont-email.me> <11bnvbq$olbj$1@dont-email.me> <11bo02r$otr5$1@dont-email.me> <11bo0ul$pbso$1@dont-email.me> <11bo1bc$phlr$1@dont-email.me> <tft5elp1q2ns7rhfp3rod862ks5ip3p0ms@4ax.com> <11c1kee$2lqi$2@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Rosario19 <Ros@invalid.invalid>
Newsgroups: comp.lang.c
Subject: Re: BizFuss (was Re: Taming The Switch-Statement)
Date: Sat, 31 Oct 2026 11:36:49 +0100
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <sggbel97ubc4ntngdfel9vlg7c7d2qpb2c@4ax.com>
References: <119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$1@dont-email.me> <11bnfpm$i84l$1@dont-email.me> <11bng23$iblc$1@dont-email.me> <11bngj1$ifj5$1@dont-email.me> <11bnnbg$l7i1$1@dont-email.me> <11bntk0$nsbo$1@dont-email.me> <11bnvbq$olbj$1@dont-email.me> <11bo02r$otr5$1@dont-email.me> <11bo0ul$pbso$1@dont-email.me> <11bo1bc$phlr$1@dont-email.me> <tft5elp1q2ns7rhfp3rod862ks5ip3p0ms@4ax.com> <11c1kee$2lqi$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 31 Oct 2026 10:28:53 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1083376"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/LDJMHy1l/m92LP+D9sCnzQ8B/PGtqFHc="; posting-host="16b6d0dc3bfca910e87f2c3e3067af6e"
Cancel-Lock: sha1:R81+VaQAi5L82pNwDdmzp6FeDaY= sha256:CsfK14/ChrFQwdlTxLjUpR0L1WSqytaMYWTW6wbRHMg=
	sha1:x84M7sIhND7drpa3gXLklpif1L8= sha256:AiZ5L9HngiN+VIyz1ybgGzP2ERT39SI5tXpLsiYwtic=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)