Timepass... Fix the code...

by rahul 1/26/2009 11:52:07 PM

Create a C# Console application, and paste the following code in the Main method...

          for (int i = 0; i < 5; i++)
          {
              //Generating a Random number between 0 and 100000
              int intRandomElement;
              Random r = new Random();
              intRandomElement = r.Next(1, 100000);
              Console.WriteLine(intRandomElement);
          }

 

If you run this code in debug mode, you should be able to get the output as expected. But if you run the same application without debugging, you would see a different result. Can you fix the code?

Enjoy!
Rahul



Tags: , ,

.NET | C# | Timepass

blog comments powered by Disqus

Comments

Search


Tags



Categories

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0