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
A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Create a user-defined data structure (struct) called Node that represents a node within a linked list where the "data" stored in each node is a pointer to a Car object.    a) Wr

c | c-c-c-c-c | c-c-C-c-c | c find distance between difftent carbon atom by programing

Program to print character array : Write a program to print the character array by using string class functions. void main() {  char line[30];   int i=0;   clrsc

Control structures The control structures appear in both structured programming languages as well as object oriented programming languages.  The three constructs used are: i)

Need algorithm for c programe #Minimum 100 words accepted#

how would land elevation have changed if Coronado had traveled 150 miles due west from what is today Arizona instead of east toward New Mexico

Aim: To implement a program for following string operations: Length of String. String Concatenation. Substring (provide start index and length) Find character a

Write a c++ program that contain the following functions : 1) Function Quality_Point that takes one int argument (student_average) and return ‘A’ if the student_average between 90-

write aprogram for random -search to implement if a[i]=x;then terminate other wise continue the search by picking new randon inex into a