This preview shows page 1. Sign up to view the full content.
Unformatted text preview: f", i %f", j %f", k %f", l %f\n", ); ); ); ); m ); return 0; /* indicate that program ended successfully */ } /* end function main */ Example Program Output
Output for program on previous page:
% a.out i j k l m % is is is is is 0.000003 1.000000 0.000001 -0.000003 230000.000000 Math Function Example
Processes like burning coal result in the emission of sulfur dioxide into the atmosphere. Sulfuric acid is formed as a result and the resulting acid rain can damage the environment. The acidity of rain and lakes is measured using pH = − log10 (C )
where C is the concentration of hydronium ions in the water. A pH value of 7 indicates a neutral value, while levels below 7 indicate an acid and above 7 an alkaline or base. Math Function Example
Algorithm: • input hydronium ion concentration • calculate pH • display results Hand calculation…consider input C = .0001 (mol/litre)
pH = − log10 (.0001) = 4 Example Program: Compound Interest
An investor plans to invest an amount of money p in an account with interest r (compounded...
View Full Document
This note was uploaded on 08/06/2010 for the course ENGR 3 taught by Professor Ben-yaakov during the Summer '08 term at UCSB.
- Summer '08