PROGRAM arith0 ! ! Author: Br. David Carlson ! ! Date: January 25, 2018 ! ! This program does a division, then multiplies by the denominator to ! see if the numerator is the result or if that product is a little off. IMPLICIT NONE REAL::numerator, denominator, quotient, product, error, relative_error numerator = 1.0 denominator = 3.0 quotient = numerator / denominator; product = quotient * denominator; WRITE (*, *) 'Dividing ', numerator, ' by ', denominator WRITE (*, *) 'The quotient is: ', quotient WRITE (*, *) 'The product of the quotient and denominator is ', product IF (numerator == product) THEN WRITE (*, *) 'The numerator and product appear to be equal.' ELSE WRITE (*, *) 'The numerator and product are NOT seen as equal.' END IF numerator = 2.0 denominator = 3.7 quotient = numerator / denominator; product = quotient * denominator; WRITE (*, *) 'Dividing ', numerator, ' by ', denominator WRITE (*, *) 'The quotient is: ', quotient WRITE (*, *) 'The product of the quotient and denominator is ', product IF (numerator == product) THEN WRITE (*, *) 'The numerator and product appear to be equal.' ELSE WRITE (*, *) 'The numerator and product are NOT seen as equal.' END IF error = product - numerator relative_error = error / numerator WRITE (*, *) 'The error is ', error WRITE (*, *) 'The relative error is ', relative_error IF (ABS(relative_error) < 2.0E-6) THEN WRITE (*, *) 'The numerator and product are approximately equal.' ELSE WRITE (*, *) 'The numerator and product are NOT approximately equal.' END IF END PROGRAM