Advertisement
Guest User

3.7 мда

a guest
Aug 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             bool b = true;
  14.             string input;
  15.             int x = 0, y =0;
  16.             int[] vs = new int[1];
  17.             while (b)
  18.             {
  19.                 Console.WriteLine("Введите число: ");
  20.                 input = Console.ReadLine();
  21.                 switch (input.ToLower())
  22.                 {
  23.                     case "sum":
  24.                         bool d = true;
  25.                         while (d)
  26.                         {
  27.                             for(int i = x; i<0; i--)
  28.                             {
  29.                                 y += vs[i];
  30.                             }
  31.                             Console.WriteLine("Сумма чисел: " + y);
  32.                             d = false;
  33.                         }
  34.                         break;
  35.                     case "sort":
  36.  
  37.                         break;
  38.                     default:
  39.                         int[] tempvs = new int[vs.Length + 1];
  40.                         for(int i=0; i <vs.Length; i++)
  41.                         {
  42.                             tempvs[i] = vs[i];
  43.                         }
  44.                         tempvs[tempvs.Length - 1] = Convert.ToInt32(input);
  45.                         tempvs = vs;
  46.                         x++;
  47.                         break;
  48.                 }
  49.  
  50.  
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement