Last active
December 10, 2019 19:09
-
-
Save oykelrae/10e9ec948f34776e67c951d741417d2b to your computer and use it in GitHub Desktop.
Water drops and molecules in a glass
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
Enter a number of glasses of water: 3 | |
The number of water drops in 3 glass.es is 14970 | |
The number of water molecules is 2.495e+25 | |
Program ended with exit code: 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
Масса одной молекулы воды приблизительно равна 3e−23 грамм. Масса одной капли воды приблизительно 0.05 гр. В одном гранёном стакане ~ 249.5 гр. | |
Напишите программу, которая вычисляет количество капель и молекул воды в N гранёных стаканах воды. |
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
#include <stdio.h> | |
int main() { | |
int n_gl; // number of glasses of water | |
int n_dr; // number of water drops | |
double n_m; // number of water molecules | |
printf("Enter a number of glasses of water: "); | |
scanf("%d", &n_gl); | |
n_dr = n_gl * 249.5 / 0.05; // number of glasses * number of water drops in one glass | |
n_m = n_gl * 249.5 / 3e-23; // number of glasses * number of water molecules in one glass | |
printf("The number of water drops in %d glass.es is %d\nThe number of water molecules is %.3e\n\n", n_gl, n_dr, n_m); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment