Click here to Skip to main content
15,892,927 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I generate a number divisable by 5, and check it? Pin
stephen.darling23-Aug-11 7:00
stephen.darling23-Aug-11 7:00 
GeneralMandatory XKCD reference Pin
jsc4224-Aug-11 1:23
professionaljsc4224-Aug-11 1:23 
AnswerRe: How do I generate a number divisable by 5, and check it? Pin
Vite Falcon23-Aug-11 7:28
Vite Falcon23-Aug-11 7:28 
GeneralRe: How do I generate a number divisable by 5, and check it? Pin
Michael A. Cochran23-Aug-11 9:17
Michael A. Cochran23-Aug-11 9:17 
GeneralRe: How do I generate a number divisable by 5, and check it? Pin
fuximus23-Aug-11 15:40
fuximus23-Aug-11 15:40 
AnswerRe: How do I generate a number divisable by 5, and check it? Pin
KP Lee23-Aug-11 8:54
KP Lee23-Aug-11 8:54 
AnswerRe: How do I generate a number divisable by 5, and check it? Pin
vaibhav9223-Aug-11 19:34
vaibhav9223-Aug-11 19:34 
AnswerRe: How do I generate a number divisable by 5, and check it? Pin
lukeer23-Aug-11 22:40
lukeer23-Aug-11 22:40 
The solution I found most elegant had already been posted by David1984 but is deleted. So I'm going to post it now:

You want a number X that can be divided by 5.
Any number Y can be multiplied by 5. The result X is divisible by definition (and by 5).

You want X to have 5 digits.
5-digit-numbers range from 10000 to 99999. Divide both by 5 and throw away the result's decimal places to get the limits for Y (2000 to 19999).

Supposed you already have an instance of Random obeying the tips on its use, you get X by using this code (X changed to a meaningful name)
C#
int randomDivisibleByFive = random.Next(2000, 19999) * 5;


Ciao,


luker

QuestionC# .net mass emailer Pin
markymark8222-Aug-11 3:38
markymark8222-Aug-11 3:38 
AnswerRe: C# .net mass emailer Pin
jschell22-Aug-11 9:24
jschell22-Aug-11 9:24 
GeneralRe: C# .net mass emailer Pin
markymark8222-Aug-11 22:15
markymark8222-Aug-11 22:15 
GeneralRe: C# .net mass emailer Pin
BobJanova22-Aug-11 23:51
BobJanova22-Aug-11 23:51 
GeneralRe: C# .net mass emailer Pin
markymark8223-Aug-11 0:01
markymark8223-Aug-11 0:01 
GeneralRe: C# .net mass emailer Pin
jschell23-Aug-11 9:31
jschell23-Aug-11 9:31 
QuestionPlease tell me what this silverlight warning message means. Pin
Xarzu21-Aug-11 22:59
Xarzu21-Aug-11 22:59 
AnswerRe: Please tell me what this silverlight warning message means. Pin
Simon Bang Terkildsen21-Aug-11 23:44
Simon Bang Terkildsen21-Aug-11 23:44 
QuestionRun Multiple Forms Pin
share_holder21-Aug-11 22:45
share_holder21-Aug-11 22:45 
AnswerRe: Run Multiple Forms Pin
Wayne Gaylard21-Aug-11 23:00
professionalWayne Gaylard21-Aug-11 23:00 
AnswerRe: Run Multiple Forms [modified] Pin
Shameel21-Aug-11 23:39
professionalShameel21-Aug-11 23:39 
GeneralRe: Run Multiple Forms Pin
BillWoodruff22-Aug-11 3:34
professionalBillWoodruff22-Aug-11 3:34 
GeneralRe: Run Multiple Forms Pin
Luc Pattyn22-Aug-11 3:49
sitebuilderLuc Pattyn22-Aug-11 3:49 
GeneralRe: Run Multiple Forms Pin
Shameel22-Aug-11 4:04
professionalShameel22-Aug-11 4:04 
GeneralRe: Run Multiple Forms [modified] Pin
BillWoodruff22-Aug-11 20:24
professionalBillWoodruff22-Aug-11 20:24 
GeneralRe: Run Multiple Forms Pin
Luc Pattyn23-Aug-11 1:45
sitebuilderLuc Pattyn23-Aug-11 1:45 
GeneralRe: Run Multiple Forms Pin
Shameel22-Aug-11 4:03
professionalShameel22-Aug-11 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.