Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] C puzzle
- Date: Thu, 25 Jul 2002 19:01:13 +0200 (CEST)
- From: <mocm@example.com>
- Subject: [tlug] C puzzle
- References: <20020726012006.M48242-100000@example.com>
Tod McQuillin writes: > > This C program: > > main() { > int i, n=20; > for(i = 0 ; i < n ; i--) > printf("-"); > } > > Can be modified into a correct program for printing 20 '-' characters in a > row by replacing a single character of the code. > > In fact, there are three different ways to do it. main() { int i, n=20; for(i = 0 ;-i < n ; i--) printf("-"); } main() { int i, n=20; for(i = 0 ; i < n ; n--) printf("-"); } Ok, what's the third? Marcus -- /--------------------------------------------------------------------\ | Dr. Marcus O.C. Metzler | | |--------------------------------|-----------------------------------| | mocm@example.com | http://www.metzlerbros.de/ | \--------------------------------------------------------------------/
- References:
- [tlug] C puzzle
- From: Tod McQuillin
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] C puzzle
- Next by Date: Re: [tlug] C puzzle
- Previous by thread: Re: [tlug] C puzzle
- Next by thread: Re: [tlug] C puzzle
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links