Advertisement
dhows

Untitled

Feb 23rd, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 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 zad_228
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int[] array = new int[50];
  14. int sum = 0;
  15. int product = 1;
  16. int countNaElementite = 0;
  17. int countNaGpodTochka = 0;
  18. int sumNaGPodtochka = 0;
  19. int countNaDPodtochka = 0;
  20. int sumNaDPodtochka = 0;
  21. int countNaEPodTochka = 0;
  22. int productNaEPodtochka = 1;
  23. int countNaJPodTochka = 0;
  24. double sumNaJPodTochka = 0;
  25. Random rnd = new Random();
  26.  
  27. for (int i = 0; i < 50; i++)
  28. {
  29. array[i] = rnd.Next(-100, 100);
  30. //a pod tochka
  31. if (Math.Abs(array[i]) > 30)
  32. {
  33. sum += array[i];
  34. }
  35.  
  36. //b pod tochka
  37. if (array[i] != 0 && array[i] % 2 == 1)
  38. {
  39. product *= array[i];
  40. }
  41.  
  42. //v pod tochka
  43. if (i % 2 == 0)
  44. {
  45. if (array[i] >= -30 && array[i] <= 30)
  46. {
  47. countNaElementite++;
  48. }
  49. }
  50.  
  51. //g pod tochka
  52. if (array[i] % 5 == 0 && array[i] != 0)
  53. {
  54. countNaGpodTochka++;
  55. sumNaGPodtochka += array[i];
  56. }
  57.  
  58. //d pod tochka
  59. if (i % 3 == 0)
  60. {
  61. sumNaDPodtochka += (array[i] * array[i]);
  62. countNaDPodtochka++;
  63. }
  64.  
  65.  
  66. // e pod tochka
  67. if (array[i] > 6 && array[i] <= 50)
  68. {
  69. countNaEPodTochka++;
  70. productNaEPodtochka *= array[i];
  71. }
  72.  
  73. //j pod tochka
  74. if (array[i] <= -6 || array[i] > 50)
  75. {
  76. sumNaJPodTochka += (1 / array[i]);
  77. countNaJPodTochka++;
  78. }
  79. }
  80.  
  81. Console.Write("A pod tochka: {0}\n", sum);
  82. Console.Write("B pod tochka: {0}\n", product);
  83. Console.Write("V pod tochka: {0}\n", countNaElementite);
  84. Console.Write("G pod tochka: {0}\n", (sumNaGPodtochka / countNaGpodTochka));
  85. Console.Write("D pod tochka: {0}\n", (Math.Sqrt((sumNaDPodtochka / countNaDPodtochka))));
  86. Console.Write("E pod tochka: {0}\n", Math.Pow(productNaEPodtochka, 1 / countNaEPodTochka));
  87. Console.Write("J pod tochka: {0}\n", (countNaJPodTochka / sumNaJPodTochka));
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement