# Try The 'C' Code !

Discussion in 'Computer Science | IT | Networking' started by Kaustubh Katdare, Jun 15, 2006.

Message Count:
199
+0
Engineering Discipline:
Computer Science
/* 1st Way: Change i in i-- by n*/
int i, n = 20;
for (i = 0; i < n; n--)
{
printf("X");
}

/* 2nd Way: Add - before i in i < n */
int i, n = 20;
for (i = 0; -i < n; i--)
{
printf("X");
}

/* 3rd Way: Change < in i < n by + */
int i, n = 20;
for (i = 0; i + n; i--)
{
printf("X");
}

### ksrbhanuCertified CEan

Message Count:
3
+0
Hi friends,

I have one method, i will try other two. mean while review this method

int i, n = 20;
for (i = 0; i < n; n--)
{
printf("X");
}

replacing the i in the decrement statement with n it works , this is one character change

### ksrbhanuCertified CEan

Message Count:
3
+0
sory guys, i have n't checked the whole chain , pradeep has already posted this metho

### spiritCertified CEan

Message Count:
1
+0
hello.....i m giving your answer n u have to tell thats right or not.....
int i, n = 20;
for (i = 0; i < n; i--)
{
printf("X");
}
1. instead of i-- in the loop,change it as n--.
2.in initialisation,n=20,change it as:n=-20.

### rahul dev choudCertified CEan

Message Count:
11