Display the integers from 1 to 20 using a while loop and the counter variable i. Assume that the variable i has been declared, but not initialized. Display only five integers per line. [Hint: Use the calculation i % 5. When the value of this expression is 0, display a newline character; otherwise, display a tab character. Use the Console.WriteLine() method to output the newline character, and use the Console.Write('\t') method to output the tab character.]
What will be an ideal response?
```
i = 1;
while (i <= 20)
{
Console.Write(i);
if (i % 5 == 0)
{
Console.WriteLine();
}
else
{
Console.Write('\t');
}
++i;
}
```
You might also like to view...
SQL is an imperative programming language.
Answer the following statement true (T) or false (F)
____ is a cross-platform application for viewing Flash content on a PC or Mac computer or deploying an app to an Android or iOS mobile device.
A. Mobile Flash B. Flash Player 10 C. Adobe AIR D. Flash Lite
COGNITIVE ASSESSMENT What is the role of the W3C?
A. own and control the Internet B. oversee research and set standards for many areas of the Internet C. control the World Wide Web; monitor and govern the use of data and information communicated over the Internet D. supervise and approve corporate and commercial use of the World Wide Web
In the figure above, the number 2 refers to the Set ____________________ Color button.
Fill in the blank(s) with the appropriate word(s).