bonjour,
je vourais convertir un entier A (ex 1236) en un tableau d'entier int[]
j'ai fait le code suivant mais ca marche pas:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 class Program { static void Main(string[] args) { transformation(1234); } static void transformation(int A) { string B = Convert.ToString(A); Console.WriteLine(B); int[] tab = new int[B.Length]; for (int i=0; i < B.Length; i++) { tab[i] = Convert.ToInt16(B[i]); Console.WriteLine(tab[i]); } Console.WriteLine(tab); Console.ReadLine(); } } }
Partager