Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Basics (Retired) Perform Order of Operations

Angus Eliott
Angus Eliott
3,793 Points

Order of operations problem

am Doing a quiz on the order of operations and put in my best answer but it refuses it. have access to a computerized scientific calculator. How do I work it out?

1 Answer

Steven Parker
Steven Parker
215,243 Points

You just need to observe the language's operator precedence and associativity to be sure you are doing things on your calculator the way the computer would. Here is a documentation page with a chart showing precedence and order of evaluation.

For example, if the formula was "3 + 4 * 5" the correct answer would be 23, not 35, since multiplication takes precedence over addition in the computer.