☢️⚗️⚗️Chemical equation balancer. ⚖️⚖️☢️ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 36

☢️⚗️⚗️Chemical equation balancer. ⚖️⚖️☢️

Write a program( in any code language) that will balance any given chemical reaction (the equation being relevant). Example : H2+Cl2 =HCl Output : H2+Cl2=2HCl The user must input using valid notations. For more information: https://www.wikihow.com/Balance-Chemical-Equations

19th Jan 2018, 1:25 PM
Navoneel
7 Answers
+ 9
https://code.sololearn.com/cps9lMGHrRP1/?ref=app
21st Jan 2018, 5:38 PM
Arun
+ 109
Use brute force 🤗
20th Jan 2018, 4:09 AM
NimWing Yuan
NimWing Yuan - avatar
+ 19
I don't think we need to apply brute force. There must be a more elegant way......
21st Jan 2018, 3:43 AM
Navoneel
+ 8
Solve a diophantine equation
21st Jan 2018, 7:25 AM
VcC
VcC - avatar
+ 7
Use this extended to more variables https://code.sololearn.com/ca6FkuqzLXdT/?ref=app
21st Jan 2018, 7:29 AM
VcC
VcC - avatar
+ 4
Am I wrong or must such code have like a whole periodic table inside, to get like the electrons in shells to calculate the chemical equation for a salt for example?
19th Jan 2018, 3:19 PM
Jonas Schröter
Jonas Schröter - avatar
+ 4
thank you marked my answer as best answer 😉😉
3rd Jun 2018, 5:06 PM
Arun