JIGYASA

An online placement forum.


You are not connected. Please login or register

Random numbers in a range

Go down  Message [Page 1 of 1]

1 Random numbers in a range on Wed Apr 28, 2010 12:54 pm

Write a C code to generate random numbers in a given range.

View user profile

2 Re: Random numbers in a range on Wed Apr 28, 2010 3:53 pm

range -> [a,b]
X -> random number

X = a + (rand()%(b-a+1))

View user profile

3 @Codecrckr on Thu Apr 29, 2010 5:54 pm

Thats correct. Keep up the good work.

View user profile

Sponsored content


Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum