--- In [email protected], [EMAIL PROTECTED] wrote: > > On 23 Mar 2007 05:08:06 -0700, GLOGIC 20 <[EMAIL PROTECTED]> wrote: > > > > > > > > >From: "Karthikeyan M" <[EMAIL PROTECTED]<Karthikeyan_M05% 40infosys.com> > > > > > >Reply-To: [email protected] <c-prog%40yahoogroups.com> > > >To: <[email protected] <c-prog%40yahoogroups.com>> > > >Subject: [c-prog] Simple but testing ! > > >Date: Fri, 23 Mar 2007 14:43:24 +0530 > > > > > > > > >Hi all, > > > > > > > > > > > >This question was asked in the aptitude test of Intel. > > > > > > > > > > > > int i, n = 20; > > > > > > > > > > > > for (i = 1; i < n; i--) > > > > > > > > > > > > printf("-"); > > > > > > > > > > > > You have to print '-' 20 times. By adding or removing or replacing > > >only a single character from the code. > > > > > > > > change i-- to n--? > > > > > > There are 3 possible solutions for the above question. What are > > >they? > > > > > > > > > > > > Time: 10 mins
i think all 3 r easy n straight forward...! 1. change i<n to i<=n 2. change n=20 to n=21 3. change i=1 to i=0
