For each of the following sets of integers, write a single statement that will print a number at random from the set.
a) 2, 4, 6, 8, 10.
b) 3, 5, 7, 9, 11.
c) 6, 10, 14, 18, 22.
a)
```
System.out.print( ( int ) ( ( 1 + Math.random() * 5 ) * 2 ) );
```
b)
```
System.out.print( ( int ) ( ( 1 + Math.random() * 5 ) * 2 + 1 ) );
```
c)
```
System.out.print( ( int ) ( ( Math.random() * 5 ) * 4 + 6 ) );
```
Computer Science & Information Technology
You might also like to view...
The question "Will the website be monitored?" should be asked during the _____ phase of web development.
A. ?planning B. ?analysis C. ?design D. ?maintenance
Computer Science & Information Technology
In a user needs assessment project, software requirements should be considered first, followed by hardware needs.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology