Teo_Yanchev

Lists - ListOfProducts - C# Fundamentals

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