Advertisement
Spocoman

04. List of Products

Feb 1st, 2022
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ListOfProducts
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int n = int.Parse(Console.ReadLine());
  11.  
  12.             List<string> products = new List<string>();
  13.  
  14.             for (int i = 0; i < n; i++)
  15.             {
  16.                 string current = Console.ReadLine();
  17.                 products.Add(current);
  18.             }
  19.             products.Sort();
  20.  
  21.             for (int i = 1; i <= products.Count; i++)
  22.             {
  23.                 Console.WriteLine($"{i}.{products[i - 1]}");
  24.             }
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement