| Philip ( @ 2003-11-14 17:18:00 |
Intel aptitude test?
Someone sent me this piece of code saying it was asked in an aptitude test for Intel:
You've got to get it to print - 20 times. You may add, subtract OR replace only one character in the above code.
I'm posting my solutions as a comment, and screening it for a while.
[update]my bad, the problem was wrong. n is initialised to 20. thanks kalyan[/update]
[update 15-11-03, 19:00 IST]I should add that I've got 3 solutions[/update]
Someone sent me this piece of code saying it was asked in an aptitude test for Intel:
int i, n = 20;
for(i = 0; i < n; i--)
printf("-");
You've got to get it to print - 20 times. You may add, subtract OR replace only one character in the above code.
I'm posting my solutions as a comment, and screening it for a while.
[update]my bad, the problem was wrong. n is initialised to 20. thanks kalyan[/update]
[update 15-11-03, 19:00 IST]I should add that I've got 3 solutions[/update]