RosettaCodeData/Task/Loop-over-multiple-arrays-simultaneously/C-sharp/loop-over-multiple-arrays-simultaneously-4.cs
2023-07-01 13:44:08 -04:00

6 lines
330 B
C#

public static void Multiloop(char[] A, char[] B, int[] C)
{
var max = Math.Max(Math.Max(A.Length, B.Length), C.Length);
for (int i = 0; i < max; i++)
Console.WriteLine($"{(i < A.Length ? A[i] : ' ')}, {(i < B.Length ? B[i] : ' ')}, {(i < C.Length ? C[i] : ' ')}");
}