Code mình có viết lại như bên dưới, muốn gọi hàm hextodec thì xuất ra mảng số dec nhưng chỉ xuất ra được số cuối cùng
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ConsoleApplication2
{
class Program
{
public static void readHexNumbers(ref int[] a)
{
StreamReader reader = new StreamReader(@"hex_numbers.txt");
string hexValues = reader.ReadLine();
string[] hexValuesSplit = hexValues.Split(' ');
Console.Write(hexValues + "\n");
for (int i = 0; i < hexValuesSplit.Length; i++)
{
int value = 0;
foreach (string hex in hexValuesSplit)
{
value = Convert.ToInt32(hex, 16);
a[i] = value;
// Console.Write(a);
}
}
}
public static void XuatMang(int[]a)
{
for (int i = 0; i < a.Length; i++)
{
Console.Write($"{a[i]}{" "}");
}
}
static void Main(string[] args)
{
int n = 14;
int[] a = new int[n];
Program p = new Program();
readHexNumbers(ref a);
XuatMang(a);
Console.ReadLine();
}
}
}

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?