Untitled

 avatar
unknown
plain_text
2 years ago
969 B
3
Indexable
 class Program
    {
        static string[] Metoda2(string s)
        {
            s = "wiersz wyjsciowy";
            int i = s.Length;
            string[] t1 = new string [i];
            int x = 0;
            while (x < i)
            {
                int j = 0;
                while (j <= x)
                {
                    t1[j] = s.Substring(0, j); //substring to pewna ilość stringów, tutaj wybieramy te od 0 do j
                    //Console.Write(t1[j]);
                    //Console.Write(t1[j]);
                    j++;
                }
                x++;
                Console.WriteLine();
            }
            return t1;
        }
        static void Main(string[] args)
        { 
            string s = "wiersz wyjsciowy";
            string[] wynik = Metoda2(s);
            foreach (string x in wynik)
                Console.WriteLine(x);
            Console.ReadKey();
        }
    }
}

Editor is loading...