Cody

Problem 1856. Molecule Atomic Wt (CHONS) Molecules

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.

Solution Stats

65.31% Correct | 34.69% Incorrect
Last solution submitted on Sep 20, 2016

Problem Comments

Solution Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more