Find the concentration of a solution using given Mass and Volume | C ++ program to find concentration of a solution using given Mass and Volume ; Function to calculate concentration from the given mass of solute and volume of a solution ; Driver Program
#include <bits/stdc++.h> NEW_LINE using namespace std ; double get_concentration ( double mass , double volume ) { if ( volume == 0 ) return -1 ; else return ( mass / volume ) * 1000 ; } int main ( ) { double mass , volume ; mass = 100.00 ; volume = 500.00 ; cout << get_concentration ( mass , volume ) ; return 0 ; }