Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Rasshirenie_massiva
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- Console.WriteLine("Введите 6 чисел через пробел ");
- string s = Console.ReadLine();
- string[] array = s.Split();
- Console.WriteLine("Введите команду summ");
- string command = Console.ReadLine();
- if (command == "summ")
- {
- int sum = 0;
- for (int i = 0; i < array.Length; i++)
- {
- sum += Convert.ToInt32(array[i]);
- Console.Write(array[i] + " ");
- }
- Console.WriteLine();
- Console.WriteLine("Сумма = " + (sum));
- Console.WriteLine("Введите команду sort");
- command = Console.ReadLine();
- if (command == "sort")
- {
- Array.Sort(array);
- foreach (string n in array)
- Console.WriteLine(n);
- }
- }
- else
- Console.WriteLine("NO! Введите команду summ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement