Advertisement
Vadim_Rogulev

Untitled

Apr 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 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 Расширение_массива
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.            
  15.             int Sum = 0;
  16.             string[] array;
  17.             string St_V = Console.ReadLine();
  18.             array = St_V.Split(new char[] { ' ' });
  19.             int[] masInt = new int[array.Length];
  20.             for (int i = 0; i < array.Length; i++)
  21.             {
  22.                 masInt[i] = Convert.ToInt32(array[i]);
  23.                 Console.Write(masInt[i] + " ");
  24.                 Sum += masInt[i];
  25.             }
  26.             Console.WriteLine();
  27.             Array.Sort(masInt);
  28.             var Obr = from i in masInt
  29.                                  orderby i descending
  30.                                  select i;
  31.             foreach (int i in Obr)
  32.                 Console.Write(i + " ");
  33.             Console.WriteLine();
  34.             Console.WriteLine(Sum);
  35.            
  36.            
  37.         }
  38.        
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement