What does the following code do?
#include
int main(void)
{
int i, j, k;
for (i = 0; i < 10; ++i) {
for (j = 0; j < 10; ++j) {
for (k = 0; k < 10; ++k) {
printf("%d%d%d\n", i, j, k);
}
}
}
return 0;
}
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
It prints a table of values, where the values could be represented in a 3-dimensional table
Join the QuestionCove community and study together with friends!
Sign Up
OpenStudy (anonymous):
000 and 999 :-D
OpenStudy (anonymous):
hmm yeah I was thinking about because it is ++i not i++
OpenStudy (anonymous):
Yes....same here. Increment happens before the test I thought in the way it was written. God it has been 12 years since I coded. So, I may be wrong.
OpenStudy (anonymous):
hmm good point I made it a habit to write ++i instead of i++ in my loops, but I never figured it would make a difference in the final part of a for-loop. Let me see what happens if I make it post-increment
http://ideone.com/y7htD
No change :(
OpenStudy (anonymous):
Interesting. I always wrote it as i++ back in the days.