Statements in a while loop or for loop body can be blocked. Write a for loop that displays "Hello" and "Goodbye" four times each using a blocked loop body.

What will be an ideal response?


The following loop displays "Hello" and "Goodbye" four times each:
const int TIMES = 4;
for(int x = 0; x < TIMES; ++x)
{
WriteLine("Hello");
WriteLine("Goodbye");
}
Without the curly braces in this code, "Hello" would be displayed four times, but "Goodbye" would be displayed only once.

Computer Science & Information Technology

You might also like to view...

Explain the use of leases in a discovery service to cope with the problem of service volatility.

What will be an ideal response?

Computer Science & Information Technology

What are the two main services provided by the network layer of the TCP/IP model?

A) Compression B) Addressing C) Routing D) Reliability E) Encryption

Computer Science & Information Technology

Portions of an Excel workbook might be saved as an HTML file with values separated by commas so that the values in Excel may be imported into an Access table.____________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Critical Thinking Questions 12-1 ? George's firm contracts to provide risk management services for a wide range of smaller companies that cannot provide the service for themselves. One of George's responsibilities at the end of each month is to review the threats encountered by the companies and put them into the appropriate categories. Another of George's clients has software that is outdated and has become increasingly vulnerable to attack. How does George categorize this threat?

A. Human error B. Technical obsolescence C. Service failure D. Espionage

Computer Science & Information Technology