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]Re: [tlug] C puzzle
- Date: Thu, 25 Jul 2002 12:54:38 -0400
- From: Viktor Pavlenko <vvp@example.com>
- Subject: Re: [tlug] C puzzle
- References: <20020726012006.M48242-100000@example.com>
>>>>> "TM" == Tod McQuillin <devin@example.com> writes: TM> This C program: TM> main() { TM> int i, n=20; TM> for(i = 0 ; i < n ; i--) TM> printf("-"); TM> } TM> Can be modified into a correct program for printing 20 '-' TM> characters in a row by replacing a single character of the TM> code. TM> In fact, there are three different ways to do it. All replacements are on line 3: 1) 'i' -> 'n' main() { int i, n=20; for(i = 0 ; i < n ; n--) printf("-"); } 2) ' ' -> '-' main() { int i, n=20; for(i = 0 ;-i < n ; i--) printf("-"); } 3) '<' -> '+' main() { int i, n=20; for(i = 0 ; i + n ; i--) printf("-"); } cheers Viktor
- Follow-Ups:
- Re: [tlug] C puzzle
- From: Martin Baehr
- Re: [tlug] C puzzle
- From: Tod McQuillin
- Re: [tlug] C puzzle
- From: Josh Glover
- Re: [tlug] C puzzle
- From: bruno raoult
- References:
- [tlug] C puzzle
- From: Tod McQuillin
Home | Main Index | Thread Index
- Prev by Date: [tlug] C puzzle
- Next by Date: [tlug] C puzzle
- Previous by thread: [tlug] C puzzle
- Next by thread: Re: [tlug] C puzzle
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links