© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
59 replies
wcasa

troubles with list length

class Solution
{
    static void Main(string[] args)
    {
        string line = Console.ReadLine();
        string[] temp = line.Split(' ');
        List<int> nums = new List<int>(temp.Length);
        for (int i = 0; i < temp.Length; i++)
        {
            nums[i] = Convert.ToInt32(temp[i]);
        }
        nums.Sort();
        Console.WriteLine($"Наименьшее значение = {nums[0]}");
        Console.WriteLine($"Наибольшее значение = {nums[nums.Count - 1]}");
    }
}
class Solution
{
    static void Main(string[] args)
    {
        string line = Console.ReadLine();
        string[] temp = line.Split(' ');
        List<int> nums = new List<int>(temp.Length);
        for (int i = 0; i < temp.Length; i++)
        {
            nums[i] = Convert.ToInt32(temp[i]);
        }
        nums.Sort();
        Console.WriteLine($"Наименьшее значение = {nums[0]}");
        Console.WriteLine($"Наибольшее значение = {nums[nums.Count - 1]}");
    }
}
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

troubles with a simple list...
C#CC# / help
4y ago
✅ getting length of a list???
C#CC# / help
3y ago
✅ Troubles with looping
C#CC# / help
14mo ago
Help with get Length
C#CC# / help
8mo ago