fork(1) download
  1. using System;
  2. using static System.Console;
  3. //using System.Linq;
  4. //using System.Text;
  5. //using System.Collections.Generic;
  6.  
  7.  
  8. class Lottery
  9. {
  10. static void Main(string[] args)
  11. {
  12. int[] Lottery = new int[3];
  13. int[] Guessing = new int[3];
  14.  
  15. Random r = new Random();
  16. for (int i = 0; i < Lottery.Length; i++)
  17. {
  18. Lottery[i] = r.Next(1, 4);
  19. }
  20. Array.Sort(Lottery);
  21.  
  22. for (int i = 0; i < Guessing.Length; i++)
  23. {
  24. Write("Enter a Number 1-4 ~~> ");
  25. Guessing[i] = int.Parse(ReadLine());
  26. }
  27.  
  28. int RightGuess = 0;
  29.  
  30. WriteLine("Drawing Results... ");
  31. for (int i = 0; i < Lottery.Length; i++)
  32. {
  33. WriteLine(Lottery[i]);
  34. for (int j = 0; j < Guessing.Length; j++)
  35. {
  36. if (Lottery[i] == Guessing[j])
  37. RightGuess++;
  38. }
  39. }
  40.  
  41. if(RightGuess == 3)
  42. WriteLine("You win $10,000!!!");
  43. else if(RightGuess == 2)
  44. WriteLine("You win $1,000!!");
  45. else if(RightGuess == 1)
  46. WriteLine("You win $100!");
  47. else if(RightGuess == 0)
  48. WriteLine("Better Luck Next Time :( ");
  49. ReadLine();
  50.  
  51.  
  52.  
  53. }
  54. }
  55.  
Success #stdin #stdout 0.05s 28584KB
stdin
1
2
3
stdout
Enter a Number 1-4 ~~> Enter a Number 1-4 ~~> Enter a Number 1-4 ~~> Drawing Results... 
2
2
3
You win $10,000!!!