Given a molecular equation string determine its atomic weight.
Limited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].
Example molecules and wts:
CH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;
Input: Molecular Eqn [string with no spaces, all Caps]
Output: Molecular Wt [approx wt]
Source: Saw this as a question on Matlab Answers.
Update: Test suite has been enhanced to include double digit numbers.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers49
Suggested Problems
-
Project Euler: Problem 9, Pythagorean numbers
1403 Solvers
-
Back to basics 8 - Matrix Diagonals
971 Solvers
-
Generate N equally spaced intervals between -L and L
954 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
14187 Solvers
-
564 Solvers
More from this Author306
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Update: Test suite has been enhanced to include double digit numbers.