Byte of thinking for a bit of problem

By alright

Problem: Find three ways to make the program below print 20 copies of the dash character ‘-’ by changing/adding one character:

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

Wrong trial:
1. Changing “n = 20″ to “n = -20″
2. Changing “i < n” to “i < -n”
3. Changing “i = 0″ to “i = 40″

Leave a Reply