Cody

Solution 460358

Submitted on 22 Jun 2014 by rifat ahmed
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% eqn='CH4'; mass=atomic_wt(eqn) assert(isequal(mass,16))
c = 'C' 'H' '4' ans = 16 mass = 16
2   Pass
%% eqn='O2'; mass=atomic_wt(eqn) assert(isequal(mass,32))
c = 'O' '2' ans = 32 mass = 32
3   Pass
%% eqn='CO2'; mass=atomic_wt(eqn) assert(isequal(mass,44))
c = 'C' 'O' '2' ans = 44 mass = 44
4   Pass
%% eqn='C2H6'; mass=atomic_wt(eqn) assert(isequal(mass,30))
c = 'C' '2' 'H' '6' ans = 30 mass = 30
5   Pass
%% eqn='H2SO4'; % 98 mass=atomic_wt(eqn) assert(isequal(mass,98))
c = 'H' '2' 'S' 'O' '4' ans = 98 mass = 98
6   Pass
%% eqn='SO4'; % 96 mass=atomic_wt(eqn) assert(isequal(mass,96))
c = 'S' 'O' '4' ans = 96 mass = 96
7   Pass
%% eqn='NO2'; % 46 mass=atomic_wt(eqn) assert(isequal(mass,46))
c = 'N' 'O' '2' ans = 46 mass = 46
8   Pass
%% eqn='NO'; % 30 mass=atomic_wt(eqn) assert(isequal(mass,30))
c = 'N' 'O' ans = 30 mass = 30