vendredi 20 mars 2020

C#: Round decimals for var made of Random

I got this (C#) :

Random RNG = new Random();
decimal divab50 = RNG.Next(50,100);
decimal divbl50 = RNG.Next(6,50);
decimal decreturn = divab50 / divbl50;
Console.WriteLine(decreturn);

How can I round the decreturn var to two decimals? I've tried Math.Round and String.Format they don't seem to work for vars generated in RNG. I think. I'm new at c# just started




Aucun commentaire:

Enregistrer un commentaire