programming challenge (silly)

root at spdyne.UUCP root at spdyne.UUCP
Sat Mar 11 11:27:00 AEST 1989


In article <3115 at homxb.ATT.COM> cjn at 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 at 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 1<CR>2<CR> 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 at 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 at spdyne
I have 



More information about the Comp.lang.c mailing list