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
program to check whether a given point lies inside a rectangle or not

Project Description: I have software written with VB that i helped design, but now the original author died,(Neil Tromp), and the software ended up in the hands of someone else!

Prepare a script for providing Instagram Followers/Likes I need to prepare a panel where my customer able to get Instagram followers or likes automatically. - A panel where I

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Q: How the compiler arranges the several sections in the executable image? A: The executable contained following sections: 1.      Data Section (initialized data variable sec


c++ coding decode the letters from numbers

Given a bool variable isReadable write some statements that assign true to isReadable if the file "topsecret" exists and can be read by the program and assigns false to isR

v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0

Program of swapping two varibales: void swap(int *, int *);   // This is swap's prototype int main() {                 int x = 5, y = 7;                 swap(&x, &