Last active
August 29, 2015 13:56
-
-
Save dillmo/8865761 to your computer and use it in GitHub Desktop.
Calculate the volume or number of particles in a mas using moles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2014 dillmo | |
* Licensed under the MIT License(http://opensource.org/licenses/MIT) | |
* | |
* A program I made for chemistry class. It calculates how many particles there | |
* are in a gas in moles, based on its volume in liters. | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
double volume, answer; | |
cout << "What is the volume of your gas?" << '\n'; | |
cin >> volume; | |
answer = volume * (1/22.4); | |
cout << scientific << answer << " mol" << '\n'; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2014 dillmo | |
* Licensed under the MIT License (http://opensource.org/licenses/MIT) | |
* | |
* A program I made for chemistry class. It calculates the volume of a gas | |
* based on the number of particles in moles. | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
double moles, answer; | |
cout << "How many particles are there in moles?" << '\n'; | |
cin >> moles; | |
answer = moles * 22.4; | |
cout << answer << " L" << '\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment