Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Tri();
- Chetire();
- }
- public static void Tri()
- {
- Console.WriteLine("введите длинну массива");
- try
- {
- int len = int.Parse(Console.ReadLine());
- int n = 0;
- int[] arr = new int[len];
- double[] arr_2 = new double[len];
- Console.WriteLine("введите элементы маасива");
- while (n < arr.Length)
- {
- int elem = int.Parse(Console.ReadLine());
- arr[n] = elem;
- n++;
- }
- int arr_min = Array.LastIndexOf(arr, arr.Min());
- int[] arr_dop_2 = arr.Skip(arr_min).ToArray();
- int dop = 0;
- foreach (int i in arr_dop_2)
- {
- dop += i;
- }
- Console.WriteLine($"Твоя сумма - {dop}");
- }
- catch
- {
- Console.WriteLine("У вас ошибка");
- }
- }
- public static void Chetire()
- {
- Console.WriteLine("введите длинну массива");
- try
- {
- int len = int.Parse(Console.ReadLine());
- int n = 0;
- double[] arr = new double[len];
- double[] arr_2 = new double[len];
- Console.WriteLine("введите элементы маасива");
- while (n < arr.Length)
- {
- double elem = double.Parse(Console.ReadLine());
- arr[n] = elem;
- n++;
- }
- n = 0;
- foreach (int i in arr)
- {
- if (i % 2 == 0)
- {
- arr_2[n] = i;
- n++;
- }
- }
- foreach (int i in arr_2)
- {
- if (i != 0)
- {
- Console.WriteLine($"Твой массив - {i}");
- }
- }
- }
- catch
- {
- Console.WriteLine("У вас ошибка");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement