Untitled
unknown
plain_text
2 years ago
875 B
4
Indexable
namespace Zadanie4 { class Program { static int [] Rekurencja2(int [] t1) { int dlugosc = t1.Length; int[] odwrocona = new int[dlugosc]; int x = dlugosc - 1; int j = 0; for(int i = x; dlugosc - 1 >= 0; i--) { odwrocona[i] = t1[j]; dlugosc--; j++; } return odwrocona; } static void Main(string[] args) { /* Napisz metodę rekurencyjną odwracającą kolejność elementów tablicy. */ int[] t1 = new int[] { 1, 2, 3 }; Console.WriteLine("Odwrócona tablica: "); int[] wynik = Rekurencja2(t1); foreach (int y in wynik) Console.WriteLine(y); Console.ReadKey(); } } }
Editor is loading...