How to print array of double values in C#

2 Answers

0 votes
using System;

class Program
{
    static void Main() {
        double[] arr = {4.89, 345.21, 52.826, 7329932.198};

		Console.WriteLine(string.Join(" ", arr));
    }
}




/*
run:

4.89 345.21 52.826 7329932.198

*/

 



answered Feb 1, 2023 by avibootz
0 votes
using System;

class Program
{
    static void Main() {
        double[] arr = {4.89, 345.21, 52.826, 7329932.198};

		foreach (double item in arr) {
            Console.WriteLine(item);
        }
    }
}




/*
run:

4.89
345.21
52.826
7329932.198

*/

 



answered Feb 1, 2023 by avibootz

Related questions

1 answer 257 views
2 answers 238 views
1 answer 227 views
1 answer 218 views
1 answer 221 views
1 answer 243 views
1 answer 315 views
...