For each of the following sets of integers, write a single statement that will display a number at random from the set.

Assume Random randomNumbers = new Random() has been defined and use
the one-parameter version of method Random.Next.

a) 2, 4, 6, 8, 10.
b) 3, 5, 7, 9, 11.
c) 6, 10, 14, 18, 22.


a) Console.WriteLine(2 + randomNumbers.Next(5) * 2);
b) Console.WriteLine(3 + randomNumbers.Next(5) * 2);
c) Console.WriteLine(6 + randomNumbers.Next(5) * 4);

Computer Science & Information Technology

You might also like to view...

You can initialize fundamental-type data members in their declarations. This is known as a(n) ________ initializer and was introduced in C++11.

a. explicit b. implicit c. global d. in-class initializer

Computer Science & Information Technology

In Safe Mode, you can use the Control Panel to uninstall recently added programs or hardware.

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

Computer Science & Information Technology

You save a Web page as a template using the ____ dialog box.

A. Template B. New Template C. Save As D. Insert Dynamic Object

Computer Science & Information Technology

The ________ query is a good alternative to the Find and Replace tool.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology