Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace zad_228
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array = new int[50];
- int sum = 0;
- int product = 1;
- int countNaElementite = 0;
- int countNaGpodTochka = 0;
- int sumNaGPodtochka = 0;
- int countNaDPodtochka = 0;
- int sumNaDPodtochka = 0;
- int countNaEPodTochka = 0;
- int productNaEPodtochka = 1;
- int countNaJPodTochka = 0;
- double sumNaJPodTochka = 0;
- Random rnd = new Random();
- for (int i = 0; i < 50; i++)
- {
- array[i] = rnd.Next(-100, 100);
- //a pod tochka
- if (Math.Abs(array[i]) > 30)
- {
- sum += array[i];
- }
- //b pod tochka
- if (array[i] != 0 && array[i] % 2 == 1)
- {
- product *= array[i];
- }
- //v pod tochka
- if (i % 2 == 0)
- {
- if (array[i] >= -30 && array[i] <= 30)
- {
- countNaElementite++;
- }
- }
- //g pod tochka
- if (array[i] % 5 == 0 && array[i] != 0)
- {
- countNaGpodTochka++;
- sumNaGPodtochka += array[i];
- }
- //d pod tochka
- if (i % 3 == 0)
- {
- sumNaDPodtochka += (array[i] * array[i]);
- countNaDPodtochka++;
- }
- // e pod tochka
- if (array[i] > 6 && array[i] <= 50)
- {
- countNaEPodTochka++;
- productNaEPodtochka *= array[i];
- }
- //j pod tochka
- if (array[i] <= -6 || array[i] > 50)
- {
- sumNaJPodTochka += (1 / array[i]);
- countNaJPodTochka++;
- }
- }
- Console.Write("A pod tochka: {0}\n", sum);
- Console.Write("B pod tochka: {0}\n", product);
- Console.Write("V pod tochka: {0}\n", countNaElementite);
- Console.Write("G pod tochka: {0}\n", (sumNaGPodtochka / countNaGpodTochka));
- Console.Write("D pod tochka: {0}\n", (Math.Sqrt((sumNaDPodtochka / countNaDPodtochka))));
- Console.Write("E pod tochka: {0}\n", Math.Pow(productNaEPodtochka, 1 / countNaEPodTochka));
- Console.Write("J pod tochka: {0}\n", (countNaJPodTochka / sumNaJPodTochka));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement