Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using static System.Console;
  4.  
  5. namespace ConsoleApp11
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Random r = new Random();
  12.  
  13. List<int> marks = new List<int>() { };
  14.  
  15. const int maxMark = 10;
  16. byte students = Convert.ToByte(ReadLine());
  17. bool more10 = false;
  18. byte more5 = 0;
  19. bool next = students <= 1 || students >= 30 ? true : false;
  20.  
  21. if (!next)
  22. {
  23. for (int i = 0; i < students; i++)
  24. {
  25. marks.Add(r.Next(1, 10));
  26. if(marks[i] >= maxMark/2)
  27. {
  28. more5++;
  29. }
  30. more10 = marks[i] == 10 ? true : false;
  31. }
  32.  
  33. if(!more10)
  34. {
  35. Console.WriteLine(more5);
  36. Console.WriteLine("No");
  37. } else
  38. {
  39. Console.WriteLine(more5);
  40. Console.WriteLine("Yes");
  41. }
  42.  
  43. }
  44. ReadLine();
  45.  
  46.  
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement