编写一段代码来查找数组中的最大数字。
int largestNum = 0; 
foreach(int num in array)
{ 
    if (num > largestNum) 
    {
        largestNum = num; 
    }
}

Console.WriteLine("The largest number in the array is " + largestNum);
[1, 5, 7, 18, 24, 32]