Guest User

Untitled

a guest
May 25th, 2020
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp13
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. int beker = int.Parse(Console.ReadLine());
  15. int case_switch;
  16. int egy = 0, ketto = 0, harom = 0, negy = 0, ot = 0, hat = 0;
  17. Random r = new Random();
  18. for (int i = 0; i <= beker; i++)
  19. {
  20. case_switch = r.Next(0, 7);
  21.  
  22. switch(case_switch)
  23. {
  24. case 1:
  25. egy++;
  26. Console.WriteLine("1");
  27. break;
  28. case 2:
  29. ketto++;
  30. Console.WriteLine("2");
  31. break;
  32. case 3:
  33. harom++;
  34. Console.WriteLine("3");
  35. break;
  36. case 4:
  37. negy++;
  38. Console.WriteLine("4");
  39. break;
  40. case 5:
  41. ot++;
  42. Console.WriteLine("5");
  43. break;
  44. case 6:
  45. hat++;
  46. Console.WriteLine("6");
  47. break;
  48. }
  49.  
  50. }
  51. Console.WriteLine("{0} darab egyes lett",egy);
  52. Console.WriteLine("{0} darab kettes lett", ketto);
  53. Console.WriteLine("{0} darab harmas lett", harom);
  54. Console.WriteLine("{0} darab negyes lett", negy);
  55. Console.WriteLine("{0} darab otos lett", ot);
  56. Console.WriteLine("{0} darab hatos lett", hat);
  57.  
  58.  
  59.  
  60.  
  61. Console.ReadKey();
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment