Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ames!killer!vector!rpp386!spdyne!root From: root@spdyne.UUCP Newsgroups: comp.lang.c Subject: Re: programming challenge (silly) Message-ID: <3900002@spdyne> Date: 11 Mar 89 01:27:00 GMT References: <2102@jasper.UUCP> Lines: 35 Nf-ID: #R:jasper.UUCP:2102:spdyne:3900002:000:1188 Nf-From: spdyne.UUCP!root Mar 10 19:27:00 1989 In article <3115@homxb.ATT.COM> cjn@homxb.ATT.COM (C.NORTHRUP) writes: >Kevin Meier from AT&T Bell Labs completed this in approx 15 minutes using >only 96 characters. I will submit his solution in a couple of days. >Gives others a chance.... kjell@saturn.ucsc.edu Writes: #> I have 91 now but am not sure about portability of main(n,m) and printf. #> #> main(n,m){scanf("%d\n",&m);while(m>1&m<10)n*=m--; ^^ Works better without this.. Remove this as it isn't needed, and makes you enter something like 12 to get it to like the 1... And then combine the two onto a single line... This will give you 91 chars... #> printf(m-1?"error\n":"answer is %d\n",n);} #> #> -- #> For athletes and programmers, ! Kjell E. Post #> a woman is the end of their career. ! CIS/CE #> ! University of California, Santa Cruz #> -- A.Wickberg ! Email: kjell@saturn.ucsc.edu > Someone said something about allowing command line -D options... This of course allows the 1 Char answer: "M", where you use -DM="main......." Kinda spoils it, -Chert Pellett root@spdyne I have