Assign random integers to the variable, C/C++ Programming

(Random Numbers) 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

(ii) (Random Numbers) write a single statement that prints a number at random from  each of the following sets:

a) 2, 4, 6, 8, 10

b) 3, 5, 7, 9, 11

c) 6, 10, 14, 18, 22

Hint: rand( ) in gives a random integer between 0 and RAND_MAX, use %  (modulus) operator to limit the range of random numbers generated.

Posted Date: 2/19/2013 1:45:57 AM | Location : United States







Related Discussions:- Assign random integers to the variable, Assignment Help, Ask Question on Assign random integers to the variable, Get Answer, Expert's Help, Assign random integers to the variable Discussions

Write discussion on Assign random integers to the variable
Your posts are moderated
Related Questions
write an algorithm for linear search algorithm

There are ''n'' ants on a ''n+1'' length rod. The ants are numbered from 1 to n and are initially placed at positions starting from position 1 till position n. They are moving eith


write a program to solve e^x

switch statement

C Program for SORTING # include stdio.h> void main() {           char a;           int *p;           int i,j,temp;           clrscr();           p=&i;

One person who is specialist at programming and solving problems with a computer Project Description: Potential computer, hardware, programming and software genius, I look

What are the benefits of using friend classes? - Friend classes are useful when a class wants to hide features from users which are required only by another, tightly coupled cl

Create an array of Strings and fill it with some interesting text, such as vacation destinations, album names, or weapon names from a CRPG. Display three elements of the array on t

how to make a program this struct items/product