Microsoft
Software
Hardware
Network
Question : C# the differences between Do While Loop and For
I have the following code, which basically do the same thing. However, they have different output layout. Can anybody help me to understand why the output layout is different? one is horizontal, one is vertical .
int counter = 1; // initialize counter
do
{
Console.Write("{0} ", counter);
++counter;
} while (counter <= 10); // end do...while
Console.WriteLine(); // outputs a newline
for (int i = 0; i < 11; i++)
{
Console.WriteLine(i);
}
Attachments:
doWhile-For.JPG
(21 KB)
(File Type Details)
doWhile&for
Answer : C# the differences between Do While Loop and For
one is write and the other is write line
Random Solutions
How do I update file, save to new location and keep original file as is using Visual Basic 2008?
jQuery or JS - Checkbox set/unset in an array?
Setting up wireless on a Cisco 1811
How do I get a user ID from a logged in user and include it in my query
Edge Sync Fails
Count/sum items between dates
Preparing a AD to add MAC hardware
identical javascript code works in one website but not in another?
SQL Express 2008 R2 not showing instance or server name
Barracuda Load Balancer 340 - balances fine but real servers cannot connect to Interenet