Let us examine hands-on how FORTRAN is able to evaluate an expression. Because all of the arithmetic operators available to us (+,-,*,/,**) have built-in priority precedences, the compiler is able to make sense of a complicated expression in a program, even if it contains no parenthetical documentation. (Use of parentheses in your expressions can be a helpful way to aid readability and ensure that your expression is evaluated in the way that you have intended).
Choose the area below to see either a demonstration of how to solve a difficult arithmetic problem in FORTRAN, or an example that can solve yourself.
|
The expression found below contains variables A, B, and C, where A and C are of type INTEGER and B is of type REAL. Assume that A = 150, B = 4.0, and C = 3. The variable ANSWER is used to store the result of the expression and is of type REAL.
Created by Dave Doyle, ddoyle@davedoyle.com and Brent Dahlen, dahlen@cs.umn.edu, 1996.