posted 18 years ago
As the subject line indicates, this is probably a very crazy question. But here goes...
I have the following code:
int a = 0;
for( int i = 0; i<10; i++)
{
print("Iteration number : "+i);
a += i;
}
print ("a = "+a);
The output will be
Iteration number : 0
Iteration number : 1
....
...
Iteration number : 9
a = 45
Is there some way I could get the "a =" line to be printed before the Iteration lines without using another loop?
i.e. the output should look like this,
a = 45
Iteration number : 0
Iteration number : 1
....
...
Iteration number : 9