Draft

Burning Coal with Hydrogen!

Description:

Given the number of atoms of Carbon [C],Hydrogen[H] and Oxygen[O]. Calculate how many molecules of Water [H2O] and Carbon Dioxide [CO2] will be produced if Hydrogen reacts before Carbon. Reaction:
2 atoms of [O] reacts with 4 atoms of [H] = gives 2 molecules of [H2O].
2 atoms of [O] reacts with 1 atom of [C] = gives 1 molecule of [CO2].

Note that Oxygen exists in pairs. So we need 2 pairs of H2(4 atoms) to react with Oxygen atoms.

FOR EXAMPLE:
(C,H,O) = (45,11,100)
return water and carbon dioxide in the following order as a string
Output should be like:
'4:45 is the water carbondioxide ratio'
(no need to simplify ratio)

More By Author:

Check out these other kata created by rajeshias

Stats:

CreatedDec 18, 2020
Warriors Trained35
Total Skips2
Total Code Submissions118
Total Times Completed24
Python Completions24
Total Stars1
% of votes with a positive feedback rating68% of 20
Total "Very Satisfied" Votes11
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes4
Total Rank Assessments19
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • rajeshias Avatar
Ad