MuffinMonster

Class Task 27#

Oct 30th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int i,num, counter = 0, min = 7;
  13.             Random r = new Random();
  14.             for (i = 0; i < 50; i++)
  15.             {
  16.                 num = r.Next(1, 7);
  17.                 if (num == 6)
  18.                     counter++;
  19.                 min = Math.Min(min, num);
  20.             }
  21.             Console.WriteLine("Number 6 appeared " + counter + " times, minimum number is: " + min);
  22.             Console.ReadLine();
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment