Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!s.cs.uiuc.edu!pathak From: pathak@s.cs.uiuc.edu Newsgroups: comp.lang.c Subject: Re: programming challenge (silly) Message-ID: <207600017@s.cs.uiuc.edu> Date: 11 Mar 89 02:44:00 GMT References: <2102@jasper.UUCP> Lines: 26 Nf-ID: #R:jasper.UUCP:2102:s.cs.uiuc.edu:207600017:000:729 Nf-From: s.cs.uiuc.edu!pathak Mar 10 20:44:00 1989 In an article by 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--; >printf(m-1?"error\n":"answer is %d\n",n);} Well, the code I ran the code through wc and it came out to be 92 chars. Still, it is a nice piece of code. However, the following modifications make the same code only 89 chars. main(n,m){for(scanf("%d",&m);m>1&m<10;n*=m--); printf(m-1?"error\n":"answer is %d\n",n);} Of course, you need to delete the newline after the first line. The code could further be optimized by getting rid of the extra "\n" after error and answer which would make it 85. Heeren Pathak s.cs.uiuc.edu zaphod.ncsa.uiuc.edu