Write statements that assign random integers to the variable n in the following ranges:

```
a) 1 n 2
b) 1 n 100
c) 0 n 9
d) 1000 n 1112
e) –1 n 1
f) –3 n 11
```


```
a) n = 1 + rand() % 2;
b) n = 1 + rand() % 100;
c) n = rand() % 10;
d) n = 1000 + rand() % 113;
e) n = rand() % 3 - 1;
f) n = rand() % 15 - 3;
```

Computer Science & Information Technology

You might also like to view...

In a __________, records typically are stored in order by the record key.

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

Computer Science & Information Technology

What is the advantage to creating a parameter query?

What will be an ideal response?

Computer Science & Information Technology

A common use of data tables is to see the effect of various interest rates

Indicate whether the statement is true or false.

Computer Science & Information Technology

Which method rearranges all open windows in Microsoft Windows?

A. clicking a window's title bar, and then clicking the Minimize button B. right-clicking the taskbar, and then clicking Cascade windows C. clicking the taskbar, and then clicking the active window D. pointing to a corner of the desktop

Computer Science & Information Technology