Pieter Pauwels Pieter Pauwels - 5 months ago 66
C# Question

PI decimal using Math.Round

i'm working for school atm and i'm stuck at a question.
The question is: generate a random number, if the number is even Round PI on 4 decimals if its odd Round PI on 2 Decimals. This is what i have as far, the text is dutch, hope some1 can help me out! :) https://gyazo.com/9b69f6f7ebb5d93a6731444f78cdc947

Answer Source

Math.Round in your code is being specified as a property, not a method invocation.

Place your parameters in the round function like Math.Round(...) - You will want to pass in the PI constant.

Math.Round(Math.PI, 4) (as stated in comments).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download