Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

c# order of operation confusion

OperationGuys my noob brain is having issues following this simple order of operation, would anybody be kind enough to enlight me on how is the computer handling this order of operation?.

Running this on Unity it throws the result printed on the book, but as simple as the operation maybe I cannot see how the computer is doing the operation.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you have to first learn the mathematics BODMAS rule and how the precedence works. Refer to this.

Now coming to your question.

it will become 5 + 1/2.

1/2 will become 0 because both the numerator and denominator are int.

and 5 + 0 is 5

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading