How to round a double to 2 decimal places in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        double d = 356.8719533;
        
        d = Math.Round((double)d, 2);
    
        Console.Write(d);
    }
}



/*
run:

356.87

*/

 



answered Sep 4, 2019 by avibootz

Related questions

3 answers 285 views
3 answers 314 views
3 answers 195 views
1 answer 132 views
4 answers 109 views
3 answers 237 views
2 answers 235 views
...