A co-worker presented me with some code the other day. I just started learning so I don't know what the answer is. Apparently it was on an aptitude test for a job here at my work.
int i, n = 20;
for (i = 0; i < n; i--)
printf("-");
Rules:
You have to print '-' 20 times by adding or removing or replacing only a single character from the code.
There are 3 possible solutions for the above question. What are they ?
Duration:
10 min.
int i, n = 20;
for (i = 0; i < n; i--)
printf("-");
Rules:
You have to print '-' 20 times by adding or removing or replacing only a single character from the code.
There are 3 possible solutions for the above question. What are they ?
Duration:
10 min.
Comment